Merge pull request #1277 from crosbymichael/tty-block
Shutdown console after process exits
This commit is contained in:
commit
c8b4e4dbe8
@ -229,6 +229,7 @@ func (p *initProcess) SetExited(status int) {
|
||||
p.mu.Lock()
|
||||
p.status = status
|
||||
p.exited = time.Now()
|
||||
p.platform.shutdownConsole(context.Background(), p.console)
|
||||
p.mu.Unlock()
|
||||
}
|
||||
|
||||
@ -241,9 +242,6 @@ func (p *initProcess) Delete(context context.Context) error {
|
||||
return fmt.Errorf("cannot delete a running container")
|
||||
}
|
||||
p.killAll(context)
|
||||
if err := p.platform.shutdownConsole(context, p.console); err != nil {
|
||||
log.G(context).WithError(err).Warn("Failed to shutdown container console")
|
||||
}
|
||||
p.Wait()
|
||||
err = p.runtime.Delete(context, p.id, nil)
|
||||
if p.io != nil {
|
||||
|
@ -86,23 +86,21 @@ func (t *Task) Pause(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (t *Task) Resume(ctx context.Context) error {
|
||||
_, err := t.shim.Resume(ctx, empty)
|
||||
if err != nil {
|
||||
err = errdefs.FromGRPC(err)
|
||||
if _, err := t.shim.Resume(ctx, empty); err != nil {
|
||||
return errdefs.FromGRPC(err)
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Task) Kill(ctx context.Context, signal uint32, all bool) error {
|
||||
_, err := t.shim.Kill(ctx, &shim.KillRequest{
|
||||
if _, err := t.shim.Kill(ctx, &shim.KillRequest{
|
||||
ID: t.id,
|
||||
Signal: signal,
|
||||
All: all,
|
||||
})
|
||||
if err != nil {
|
||||
}); err != nil {
|
||||
return errdefs.FromGRPC(err)
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) {
|
||||
@ -125,7 +123,6 @@ func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runt
|
||||
|
||||
func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
|
||||
resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{
|
||||
// TODO: (@crosbymichael) this id can probably be removed
|
||||
ID: t.id,
|
||||
})
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user