Merge pull request #2216 from tedyu/kata-vc-kill

vc: Remove unnecessary call to kill
This commit is contained in:
Graham Whaley 2019-11-19 17:30:18 +00:00 committed by GitHub
commit 66f0ec526e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 13 deletions

View File

@ -513,15 +513,11 @@ func (a *Acrn) stopSandbox() (err error) {
pid := a.state.PID
// Check if VM process is running, in case it is not, let's
// return from here.
if err = syscall.Kill(pid, syscall.Signal(0)); err != nil {
a.Logger().Info("acrn VM already stopped")
return nil
}
// Send signal to the VM process to try to stop it properly
if err = syscall.Kill(pid, syscall.SIGINT); err != nil {
if err == syscall.ESRCH {
return nil
}
a.Logger().Info("Sending signal to stop acrn VM failed")
return err
}

View File

@ -467,14 +467,11 @@ func (fc *firecracker) fcEnd() (err error) {
pid := fc.info.PID
// Check if VM process is running, in case it is not, let's
// return from here.
if err = syscall.Kill(pid, syscall.Signal(0)); err != nil {
return nil
}
// Send a SIGTERM to the VM process to try to stop it properly
if err = syscall.Kill(pid, syscall.SIGTERM); err != nil {
if err == syscall.ESRCH {
return nil
}
return err
}