mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
runsc: allow kill --all when container is in stopped state.
PiperOrigin-RevId: 215009105 Change-Id: I1ab12eddf7694c4db98f6dafca9dae352a33f7c4
This commit is contained in:
@@ -472,9 +472,17 @@ func (c *Container) WaitPID(pid int32, clearStatus bool) (syscall.WaitStatus, er
|
||||
// TODO: Distinguish different error types.
|
||||
func (c *Container) Signal(sig syscall.Signal, all bool) error {
|
||||
log.Debugf("Signal container %q: %v", c.ID, sig)
|
||||
if err := c.requireStatus("signal", Running); err != nil {
|
||||
// Signaling container in Stopped state is allowed. When all=false,
|
||||
// an error will be returned anyway; when all=true, this allows
|
||||
// sending signal to other processes inside the container even
|
||||
// after the init process exits. This is especially useful for
|
||||
// container cleanup.
|
||||
if err := c.requireStatus("signal", Running, Stopped); err != nil {
|
||||
return err
|
||||
}
|
||||
if !c.isSandboxRunning() {
|
||||
return fmt.Errorf("container is not running")
|
||||
}
|
||||
// TODO: Query the container for its state, then save it.
|
||||
return c.Sandbox.Signal(c.ID, sig, all)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user