fix: parse error text when silent fail

resolves #1739
This commit is contained in:
Jan De Dobbeleer 2022-02-10 19:39:54 +01:00 committed by Jan De Dobbeleer
parent 3896b78e1d
commit 57d481c9b4
2 changed files with 8 additions and 2 deletions

3
.vscode/launch.json vendored
View file

@ -9,7 +9,8 @@
"program": "${workspaceRoot}/src",
"args": [
"--config=${workspaceRoot}/themes/jandedobbeleer.omp.json",
"--shell=pwsh"
"--shell=pwsh",
"--pwd=/Users/jan/Projects/test"
]
},
{

View file

@ -397,7 +397,12 @@ func (env *ShellEnvironment) RunCommand(command string, args ...string) (string,
env.log(Error, "RunCommand", errorStr)
return output, cmdErr
}
output := strings.TrimSpace(out.String())
// some silly commands return 0 and the output is in stderr instead of stdout
result := out.String()
if len(result) == 0 {
result = err.String()
}
output := strings.TrimSpace(result)
env.log(Debug, "RunCommand", output)
return output, nil
}