Merge pull request #1440 from mlaventure/fix-shim-panic

Fix panic in CloseIO when not Stdin was allocated for a process
This commit is contained in:
Michael Crosby
2017-08-29 13:33:05 -04:00
committed by GitHub

View File

@@ -330,8 +330,10 @@ func (s *Service) CloseIO(ctx context.Context, r *shimapi.CloseIORequest) (*goog
if !ok { if !ok {
return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process does not exist %s", r.ID) return nil, errdefs.ToGRPCf(errdefs.ErrNotFound, "process does not exist %s", r.ID)
} }
if err := p.Stdin().Close(); err != nil { if stdin := p.Stdin(); stdin != nil {
return nil, err if err := stdin.Close(); err != nil {
return nil, errors.Wrap(err, "close stdin")
}
} }
return empty, nil return empty, nil
} }