avoid blocking on full-pipe conditions for procs that write to stdout, which we continue to ignore
This commit is contained in:
		@@ -19,6 +19,7 @@ package tasks
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io"
 | 
						"io"
 | 
				
			||||||
 | 
						"io/ioutil"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
	"sync"
 | 
						"sync"
 | 
				
			||||||
	"sync/atomic"
 | 
						"sync/atomic"
 | 
				
			||||||
@@ -218,10 +219,15 @@ func notStartedTask(t *Task) taskStateFn {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// create command
 | 
						// create command
 | 
				
			||||||
	cmd := exec.Command(t.bin, t.args...)
 | 
						cmd := exec.Command(t.bin, t.args...)
 | 
				
			||||||
	if _, err := cmd.StdoutPipe(); err != nil {
 | 
						stdout, err := cmd.StdoutPipe()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
		t.tryError(fmt.Errorf("error getting stdout of %v: %v", t.name, err))
 | 
							t.tryError(fmt.Errorf("error getting stdout of %v: %v", t.name, err))
 | 
				
			||||||
		return taskShouldRestart
 | 
							return taskShouldRestart
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						go func() {
 | 
				
			||||||
 | 
							defer stdout.Close()
 | 
				
			||||||
 | 
							io.Copy(ioutil.Discard, stdout) // TODO(jdef) we might want to save this at some point
 | 
				
			||||||
 | 
						}()
 | 
				
			||||||
	stderrLogs, err := cmd.StderrPipe()
 | 
						stderrLogs, err := cmd.StderrPipe()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.tryError(fmt.Errorf("error getting stderr of %v: %v", t.name, err))
 | 
							t.tryError(fmt.Errorf("error getting stderr of %v: %v", t.name, err))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user