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:
committed by
Daniel Theophanes
parent
fffe6c52ed
commit
28e7e9edbb
+2
-1
@@ -7,6 +7,7 @@
|
|||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@@ -99,7 +100,7 @@ func runCommand(command string, readStdout bool, arguments ...string) (int, stri
|
|||||||
// so check for emtpy stderr
|
// so check for emtpy stderr
|
||||||
if command == "launchctl" {
|
if command == "launchctl" {
|
||||||
slurp, _ := ioutil.ReadAll(stderr)
|
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)
|
return 0, "", fmt.Errorf("%q failed with stderr: %s", command, slurp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user