From bde2a91433cfbac426577a691bf13817115b53be Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Thu, 13 Sep 2018 16:36:53 -0700 Subject: runsc: Support container signal/wait. This CL: 1) Fix `runsc wait`, it now also works after the container exits; 2) Generate correct container state in Load; 2) Make sure `Destory` cleanup everything before successfully return. PiperOrigin-RevId: 212900107 Change-Id: Ie129cbb9d74f8151a18364f1fc0b2603eac4109a --- runsc/cmd/checkpoint.go | 2 +- runsc/cmd/debug.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'runsc/cmd') diff --git a/runsc/cmd/checkpoint.go b/runsc/cmd/checkpoint.go index 05014ba3d..7c2c3f59e 100644 --- a/runsc/cmd/checkpoint.go +++ b/runsc/cmd/checkpoint.go @@ -129,7 +129,7 @@ func (c *Checkpoint) Execute(_ context.Context, f *flag.FlagSet, args ...interfa log.Warningf("ignoring console socket since it cannot be restored") } - if err := cont.DestroyAndWait(); err != nil { + if err := cont.Destroy(); err != nil { Fatalf("error destroying container: %v", err) } diff --git a/runsc/cmd/debug.go b/runsc/cmd/debug.go index b20987b2c..caa44168b 100644 --- a/runsc/cmd/debug.go +++ b/runsc/cmd/debug.go @@ -95,10 +95,10 @@ func (d *Debug) Execute(_ context.Context, f *flag.FlagSet, args ...interface{}) } } - log.Infof("Found sandbox %q, PID: %d", c.Sandbox.ID, c.Sandbox.Pid) - if !c.IsRunning() { - Fatalf("sandbox %q is not running", c.Sandbox.ID) + if c.Sandbox == nil || !c.Sandbox.IsRunning() { + Fatalf("container sandbox is not running") } + log.Infof("Found sandbox %q, PID: %d", c.Sandbox.ID, c.Sandbox.Pid) if d.signal > 0 { log.Infof("Sending signal %d to process: %d", d.signal, c.Sandbox.Pid) -- cgit v1.2.3