Merge pull request #16252 from gocurr/avoid_hardcoding

pkg/expect: avoid hardcoding when checking ErrProcessDone
This commit is contained in:
Benjamin Wang 2023-07-18 09:47:03 +01:00 committed by GitHub
commit 7aad281317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -286,7 +286,7 @@ func (ep *ExpectProcess) ExitError() error {
// Stop signals the process to terminate via SIGTERM // Stop signals the process to terminate via SIGTERM
func (ep *ExpectProcess) Stop() error { func (ep *ExpectProcess) Stop() error {
err := ep.Signal(syscall.SIGTERM) err := ep.Signal(syscall.SIGTERM)
if err != nil && strings.Contains(err.Error(), "os: process already finished") { if err != nil && errors.Is(err, os.ErrProcessDone) {
return nil return nil
} }
return err return err