Call delete before closing IO in shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
bd23df8fd1
commit
52a1dfb418
2 changed files with 6 additions and 3 deletions
|
@ -58,11 +58,9 @@ func main() {
|
||||||
if err := p.Close(); err != nil {
|
if err := p.Close(); err != nil {
|
||||||
logrus.WithField("error", err).Error("shim: close stdio")
|
logrus.WithField("error", err).Error("shim: close stdio")
|
||||||
}
|
}
|
||||||
if err := p.delete(); err != nil {
|
|
||||||
logrus.WithField("error", err).Error("shim: delete runtime state")
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
if err := p.start(); err != nil {
|
if err := p.start(); err != nil {
|
||||||
|
p.delete()
|
||||||
logrus.WithField("error", err).Error("shim: start process")
|
logrus.WithField("error", err).Error("shim: start process")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -117,6 +115,7 @@ func main() {
|
||||||
}
|
}
|
||||||
// runtime has exited so the shim can also exit
|
// runtime has exited so the shim can also exit
|
||||||
if exitShim {
|
if exitShim {
|
||||||
|
p.delete()
|
||||||
p.Wait()
|
p.Wait()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,10 @@ func (p *testProcess) Close() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *testProcess) State() runtime.State {
|
||||||
|
return runtime.Running
|
||||||
|
}
|
||||||
|
|
||||||
func TestSortProcesses(t *testing.T) {
|
func TestSortProcesses(t *testing.T) {
|
||||||
p := []runtime.Process{
|
p := []runtime.Process{
|
||||||
&testProcess{"ls"},
|
&testProcess{"ls"},
|
||||||
|
|
Loading…
Reference in a new issue