We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0d1586 commit 42bb73cCopy full SHA for 42bb73c
tool/vcs.rb
@@ -91,14 +91,20 @@ def popen(*args)
91
end
92
using DebugPOpen
93
module DebugSystem
94
- def system(*args, **opts)
95
- STDERR.puts [*args, **opts].inspect if $DEBUG
+ def system(*args)
+ STDERR.puts args.inspect if $DEBUG
96
+ exception = false
97
+ opts = Hash.try_convert(args[-1])
98
if RUBY_VERSION >= "2.6"
99
+ unless opts
100
+ opts = {}
101
+ args << opts
102
+ end
103
exception = opts.fetch(:exception) {opts[:exception] = true}
- else
104
+ elsif opts
105
exception = opts.delete(:exception) {true}
106
- ret = super(*args, **opts)
107
+ ret = super(*args)
108
raise "Command failed with status (#$?): #{args[0]}" if exception and !ret
109
ret
110
0 commit comments