Use named error return for service#StartShim
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
parent
9b4967bd6b
commit
f8ade8debd
@ -159,7 +159,7 @@ func readSpec() (*spec, error) {
|
||||
return &s, nil
|
||||
}
|
||||
|
||||
func (s *service) StartShim(ctx context.Context, id, containerdBinary, containerdAddress, containerdTTRPCAddress string) (string, error) {
|
||||
func (s *service) StartShim(ctx context.Context, id, containerdBinary, containerdAddress, containerdTTRPCAddress string) (_ string, retErr error) {
|
||||
cmd, err := newCommand(ctx, id, containerdBinary, containerdAddress, containerdTTRPCAddress)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@ -202,7 +202,7 @@ func (s *service) StartShim(ctx context.Context, id, containerdBinary, container
|
||||
return "", err
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if retErr != nil {
|
||||
cmd.Process.Kill()
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user