mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
avoid blocking on full-pipe conditions for procs that write to stdout, which we continue to ignore
This commit is contained in:
parent
5174ca21f6
commit
df246991e0
@ -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))
|
||||||
|
Loading…
Reference in New Issue
Block a user