mirror of https://github.com/docker/docs.git
Merge pull request #3805 from alexlarsson/execdriver-drop-getexitcode
exexdriver: Make Command.GetExitCode an internal call
This commit is contained in:
commit
09ed7e8878
|
@ -6,6 +6,7 @@ import (
|
||||||
"github.com/dotcloud/docker/pkg/mount"
|
"github.com/dotcloud/docker/pkg/mount"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -67,7 +68,16 @@ func (d *driver) Run(c *execdriver.Command, startCallback execdriver.StartCallba
|
||||||
}
|
}
|
||||||
|
|
||||||
err = c.Wait()
|
err = c.Wait()
|
||||||
return c.GetExitCode(), err
|
return getExitCode(c), err
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the exit code of the process
|
||||||
|
// if the process has not exited -1 will be returned
|
||||||
|
func getExitCode(c *execdriver.Command) int {
|
||||||
|
if c.ProcessState == nil {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return c.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *driver) Kill(p *execdriver.Command, sig int) error {
|
func (d *driver) Kill(p *execdriver.Command, sig int) error {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package execdriver
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -109,12 +108,3 @@ func (c *Command) Pid() int {
|
||||||
}
|
}
|
||||||
return c.Process.Pid
|
return c.Process.Pid
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the exit code of the process
|
|
||||||
// if the process has not exited -1 will be returned
|
|
||||||
func (c *Command) GetExitCode() int {
|
|
||||||
if c.ProcessState == nil {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
return c.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
|
|
||||||
}
|
|
||||||
|
|
|
@ -169,7 +169,16 @@ func (d *driver) Run(c *execdriver.Command, startCallback execdriver.StartCallba
|
||||||
|
|
||||||
<-waitLock
|
<-waitLock
|
||||||
|
|
||||||
return c.GetExitCode(), waitErr
|
return getExitCode(c), waitErr
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the exit code of the process
|
||||||
|
// if the process has not exited -1 will be returned
|
||||||
|
func getExitCode(c *execdriver.Command) int {
|
||||||
|
if c.ProcessState == nil {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
return c.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *driver) Kill(c *execdriver.Command, sig int) error {
|
func (d *driver) Kill(c *execdriver.Command, sig int) error {
|
||||||
|
|
Loading…
Reference in New Issue