Merge pull request #316 from cpuguy83/race_on_output_start_error
Fix for race from error on process start
This commit is contained in:
commit
f152edcb1c
|
@ -133,16 +133,23 @@ func TestExecInError(t *testing.T) {
|
|||
}()
|
||||
ok(t, err)
|
||||
|
||||
unexistent := &libcontainer.Process{
|
||||
Args: []string{"unexistent"},
|
||||
Env: standardEnvironment,
|
||||
}
|
||||
err = container.Start(unexistent)
|
||||
if err == nil {
|
||||
t.Fatal("Should be an error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "executable file not found") {
|
||||
t.Fatalf("Should be error about not found executable, got %s", err)
|
||||
for i := 0; i < 42; i++ {
|
||||
var out bytes.Buffer
|
||||
unexistent := &libcontainer.Process{
|
||||
Args: []string{"unexistent"},
|
||||
Env: standardEnvironment,
|
||||
Stdout: &out,
|
||||
}
|
||||
err = container.Start(unexistent)
|
||||
if err == nil {
|
||||
t.Fatal("Should be an error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "executable file not found") {
|
||||
t.Fatalf("Should be error about not found executable, got %s", err)
|
||||
}
|
||||
if !bytes.Contains(out.Bytes(), []byte("executable file not found")) {
|
||||
t.Fatalf("executable file not found error not delivered to stdio:\n%s", out.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ func (p *setnsProcess) start() (err error) {
|
|||
return newSystemError(err)
|
||||
}
|
||||
if ierr != nil {
|
||||
p.wait()
|
||||
return newSystemError(ierr)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue