Skip to content

Commit

Permalink
sync varlink/bridge.go varlink/bridge_windows.go
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldh committed Jan 14, 2019
1 parent 09b2c97 commit 9df428d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions varlink/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

type PipeCon struct {
net.Conn
cmd *exec.Cmd
cmd *exec.Cmd
reader *io.ReadCloser
writer *io.WriteCloser
}
Expand Down Expand Up @@ -44,7 +44,7 @@ func NewBridge(bridge string) (*Connection, error) {
if err != nil {
return nil, err
}
c.conn = PipeCon{nil, cmd, &r, &w,}
c.conn = PipeCon{nil, cmd, &r, &w}
c.address = ""
c.reader = bufio.NewReader(r)
c.writer = bufio.NewWriter(w)
Expand Down
16 changes: 8 additions & 8 deletions varlink/bridge_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package varlink
import (
"bufio"
"io"
"log"
"net"
"os/exec"
)

type PipeCon struct {
net.Conn
cmd *exec.Cmd
reader *io.ReadCloser
writer *io.WriteCloser
}
Expand All @@ -23,6 +23,8 @@ func (p PipeCon) Close() error {
if err2 != nil {
return err2
}
p.cmd.Wait()

return nil
}

Expand All @@ -40,17 +42,15 @@ func NewBridge(bridge string) (*Connection, error) {
if err != nil {
return nil, err
}
c.conn = PipeCon{nil, &r, &w}
c.conn = PipeCon{nil, cmd, &r, &w}
c.address = ""
c.reader = bufio.NewReader(r)
c.writer = bufio.NewWriter(w)

go func() {
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
}()
err = cmd.Start()
if err != nil {
return nil, err
}

return &c, nil
}

0 comments on commit 9df428d

Please sign in to comment.