diff --git a/linux_container.go b/linux_container.go index 89143260..8f733d47 100644 --- a/linux_container.go +++ b/linux_container.go @@ -230,7 +230,7 @@ func (c *linuxContainer) Resume() error { func (c *linuxContainer) Signal(signal os.Signal) error { glog.Infof("sending signal %d to pid %d", signal, c.initProcess.pid()) - panic("not implemented") + return c.initProcess.signal(signal) } // TODO: rename to be more descriptive diff --git a/linux_factory.go b/linux_factory.go index f2af2897..16182927 100644 --- a/linux_factory.go +++ b/linux_factory.go @@ -224,3 +224,7 @@ func (p *restoredProcess) wait() (*os.ProcessState, error) { func (p *restoredProcess) startTime() (string, error) { return p.processStartTime, nil } + +func (p *restoredProcess) signal(s os.Signal) error { + return newGenericError(fmt.Errorf("restored process cannot be signaled"), SystemError) +} diff --git a/linux_process.go b/linux_process.go index f6c8a14c..0de894ab 100644 --- a/linux_process.go +++ b/linux_process.go @@ -32,6 +32,8 @@ type parentProcess interface { // startTime return's the process start time. startTime() (string, error) + + signal(os.Signal) error } type setnsProcess struct { @@ -47,6 +49,10 @@ func (p *setnsProcess) startTime() (string, error) { return system.GetProcessStartTime(p.pid()) } +func (p *setnsProcess) signal(s os.Signal) error { + return p.forkedProcess.Signal(s) +} + func (p *setnsProcess) start() (err error) { defer p.parentPipe.Close() if p.forkedProcess, err = p.execSetns(); err != nil { @@ -260,3 +266,7 @@ func (p *initProcess) newUsernsSetupProcess() (parentProcess, error) { config: p.config, }, nil } + +func (p *initProcess) signal(s os.Signal) error { + return p.cmd.Process.Signal(s) +}