Skip to content

Commit

Permalink
Merge pull request bibendi#150 from bibendi/fix/subprocess-runner
Browse files Browse the repository at this point in the history
Return command status from subprocess runner
  • Loading branch information
bibendi authored May 7, 2022
2 parents 5d19f42 + 461c101 commit b5b71b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/dip/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ def self.call(cmdline, env: {}, **options)

class SubprocessRunner
def self.call(cmdline, env: {}, panic: true, **options)
return if ::Kernel.system(env, cmdline, **options)
raise Dip::Error, "Command '#{cmdline}' executed with error." if panic
status = ::Kernel.system(env, cmdline, **options)

if !status && panic
raise Dip::Error, "Command '#{cmdline}' executed with error"
else
status
end
end
end

Expand Down

0 comments on commit b5b71b9

Please sign in to comment.