quietly return exit code of external command
This commit is contained in:
parent
acaaa28fd7
commit
cfb8eebf30
2 changed files with 7 additions and 7 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
|
|
@ -49,7 +50,11 @@ func main() {
|
|||
if isShell {
|
||||
err = command.ExecuteShellAlias(expandedArgs)
|
||||
if err != nil {
|
||||
fmt.Fprintf(stderr, "failed to run alias %q: %s\n", expandedArgs, err)
|
||||
if ee, ok := err.(*exec.ExitError); ok {
|
||||
os.Exit(ee.ExitCode())
|
||||
}
|
||||
|
||||
fmt.Fprintf(stderr, "failed to run external command: %s", err)
|
||||
os.Exit(3)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -374,12 +374,7 @@ func ExecuteShellAlias(args []string) error {
|
|||
externalCmd.Stdin = os.Stdin
|
||||
preparedCmd := run.PrepareCmd(externalCmd)
|
||||
|
||||
err := preparedCmd.Run()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to run external command: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return preparedCmd.Run()
|
||||
}
|
||||
|
||||
func findSh() (string, error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue