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.mu.Lock()
|
||||||
p.status = status
|
p.status = status
|
||||||
p.exited = time.Now()
|
p.exited = time.Now()
|
||||||
|
p.platform.shutdownConsole(context.Background(), p.console)
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,9 +242,6 @@ func (p *initProcess) Delete(context context.Context) error {
|
|||||||
return fmt.Errorf("cannot delete a running container")
|
return fmt.Errorf("cannot delete a running container")
|
||||||
}
|
}
|
||||||
p.killAll(context)
|
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()
|
p.Wait()
|
||||||
err = p.runtime.Delete(context, p.id, nil)
|
err = p.runtime.Delete(context, p.id, nil)
|
||||||
if p.io != 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 {
|
func (t *Task) Resume(ctx context.Context) error {
|
||||||
_, err := t.shim.Resume(ctx, empty)
|
if _, err := t.shim.Resume(ctx, empty); err != nil {
|
||||||
if err != nil {
|
return errdefs.FromGRPC(err)
|
||||||
err = errdefs.FromGRPC(err)
|
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Task) Kill(ctx context.Context, signal uint32, all bool) error {
|
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,
|
ID: t.id,
|
||||||
Signal: signal,
|
Signal: signal,
|
||||||
All: all,
|
All: all,
|
||||||
})
|
}); err != nil {
|
||||||
if err != nil {
|
|
||||||
return errdefs.FromGRPC(err)
|
return errdefs.FromGRPC(err)
|
||||||
}
|
}
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Task) Exec(ctx context.Context, id string, opts runtime.ExecOpts) (runtime.Process, error) {
|
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) {
|
func (t *Task) Pids(ctx context.Context) ([]uint32, error) {
|
||||||
resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{
|
resp, err := t.shim.ListPids(ctx, &shim.ListPidsRequest{
|
||||||
// TODO: (@crosbymichael) this id can probably be removed
|
|
||||||
ID: t.id,
|
ID: t.id,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user