Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions io.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func inLoop(pipe io.WriteCloser, stdin io.Reader, done chan bool) {
func inLoop2(pipe io.WriteCloser, proc *exec.Cmd, stdin io.Reader, done chan bool) {
buf := make([]byte, 3)
logger.Println("Entering stdin loop")
done <- true
loop: for {
bytes_read, read_err := io.ReadFull(stdin, buf[:2])
if read_err == io.EOF && bytes_read == 0 {
Expand All @@ -86,7 +85,8 @@ func inLoop2(pipe io.WriteCloser, proc *exec.Cmd, stdin io.Reader, done chan boo
logger.Printf("in: packet length = %v\n", length)
if length == 0 {
// this is how Porcelain signals EOF from Elixir
break
pipe.Close()
continue
}

_, read_err = io.ReadFull(stdin, buf[2:])
Expand Down Expand Up @@ -122,7 +122,7 @@ func inLoop2(pipe io.WriteCloser, proc *exec.Cmd, stdin io.Reader, done chan boo
}
}
pipe.Close()
done <- true
logger.Println("Exiting stdin loop")
}

///
Expand Down
5 changes: 1 addition & 4 deletions proto_2_0.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ func proto_2_0(inFlag, outFlag bool, errFlag, workdir string, args []string) err
doneChan := make(chan bool, 3)
doneCount := 0

if inFlag {
wrapStdin2(proc, os.Stdin, doneChan)
doneCount++
}
wrapStdin2(proc, os.Stdin, doneChan)

if outFlag {
wrapStdout(proc, os.Stdout, stdoutMarker, doneChan)
Expand Down