fix(cmd): return empty on error

resolves #1783
This commit is contained in:
Jan De Dobbeleer 2022-02-19 14:35:57 +01:00 committed by Jan De Dobbeleer
parent 8c8f3e411d
commit e62482c56f

View file

@ -429,8 +429,10 @@ func (env *ShellEnvironment) RunCommand(command string, args ...string) (string,
func (env *ShellEnvironment) RunShellCommand(shell, command string) string {
defer env.trace(time.Now(), "RunShellCommand", shell, command)
out, _ := env.RunCommand(shell, "-c", command)
return out
if out, err := env.RunCommand(shell, "-c", command); err == nil {
return out
}
return ""
}
func (env *ShellEnvironment) HasCommand(command string) bool {