bugfix(unix): Check for and ingore "Operating in progress" (#182)

Added some checking in the stderr reading of `run` in `service_unix` to
identify if the output ended with `Operation now in progress` is the
command was `launchctl`.

If the output has the suffix it is ignored and treated as a non-error,
all other standard error output is treaded as an error like normal.
This commit is contained in:
Liam Haworth
2019-10-18 01:56:41 +11:00
committed by Daniel Theophanes
parent fffe6c52ed
commit 28e7e9edbb
+2 -1
View File
@@ -7,6 +7,7 @@
package service
import (
"bytes"
"fmt"
"io"
"io/ioutil"
@@ -99,7 +100,7 @@ func runCommand(command string, readStdout bool, arguments ...string) (int, stri
// so check for emtpy stderr
if command == "launchctl" {
slurp, _ := ioutil.ReadAll(stderr)
if len(slurp) > 0 {
if len(slurp) > 0 && !bytes.HasSuffix(slurp, []byte("Operation now in progress\n")) {
return 0, "", fmt.Errorf("%q failed with stderr: %s", command, slurp)
}
}