Skip to content

Commit a21b70a

Browse files
committed
Split out message surfacing improvment to separate PR.
Moved to: #17310
1 parent e7519a3 commit a21b70a

2 files changed

Lines changed: 7 additions & 35 deletions

File tree

rakelib/artifacts.rake

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -127,34 +127,12 @@ namespace "artifact" do
127127
result
128128
end
129129

130-
##
131-
# @override safe_system([env,] command... [,options])
132-
# execute Kernel#system call,checking the exit status of the executed command and eventually reporting as exception
130+
# execute Kernel#system call,checking the exist status of the executed command and eventually reporting as exception
133131
def safe_system(*args)
134-
command = args.dup # avoid mutating input for reporting
135-
env = command.size > 1 && command.first.kind_of?(Hash) ? command.shift : {}
136-
options = command.size > 1 && command.last.kind_of?(Hash) ? command.pop : {}
137-
fail("unsupported options #{options}") unless options.empty?
138-
139-
# Normalize command to a single string from either a multi-word string
140-
# or an array of individual words
141-
command = command.size > 1 ? Shellwords.join(command.map(&:to_s)) : command.first.to_s
142-
143-
# prepend the environment
144-
env.each do |k,v|
145-
command.prepend("#{Shellwords.escape(k.to_s)}=#{Shellwords.escape(v.to_s)} ")
146-
end
147-
148-
output = `#{command} 2>&1`
149-
status = $?
150-
151-
if !status.success?
152-
puts "Command failed: #{args.inspect}"
153-
puts "Output: #{output}"
132+
if !system(*args)
133+
status = $?
154134
raise "Got exit status #{status.exitstatus} attempting to execute #{args.inspect}!"
155135
end
156-
157-
true
158136
end
159137

160138
desc "Generate rpm, deb, tar and zip artifacts"

rubyUtils.gradle

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,10 @@ void rake(File projectDir, File buildDir, String task) {
158158
jruby.currentDirectory = projectDir
159159
jruby.runScriptlet("require 'rake'; require 'time'")
160160
jruby.runScriptlet("""
161-
begin
162-
rake = Rake.application
163-
rake.init
164-
rake.load_rakefile
165-
rake['${task}'].invoke
166-
rescue => e
167-
puts "Rake task error: #{e.class}: #{e.message}"
168-
puts "Backtrace: #{e.backtrace.join("\\n")}"
169-
raise e
170-
end
161+
rake = Rake.application
162+
rake.init
163+
rake.load_rakefile
164+
rake['${task}'].invoke
171165
"""
172166
)
173167
}

0 commit comments

Comments
 (0)