Merge pull request #19595 from gromgit/popen/fix-err-msg
popen: get correct cmd name on error
This commit is contained in:
commit
358af263b4
@ -51,13 +51,18 @@ module Utils
|
|||||||
yield pipe
|
yield pipe
|
||||||
else
|
else
|
||||||
options[:err] ||= File::NULL unless ENV["HOMEBREW_STDERR"]
|
options[:err] ||= File::NULL unless ENV["HOMEBREW_STDERR"]
|
||||||
|
cmd = if args[0].is_a? Hash
|
||||||
|
args[1]
|
||||||
|
else
|
||||||
|
args[0]
|
||||||
|
end
|
||||||
begin
|
begin
|
||||||
exec(*args, options)
|
exec(*args, options)
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
$stderr.puts "brew: command not found: #{args[0]}" if options[:err] != :close
|
$stderr.puts "brew: command not found: #{cmd}" if options[:err] != :close
|
||||||
exit! 127
|
exit! 127
|
||||||
rescue SystemCallError
|
rescue SystemCallError
|
||||||
$stderr.puts "brew: exec failed: #{args[0]}" if options[:err] != :close
|
$stderr.puts "brew: exec failed: #{cmd}" if options[:err] != :close
|
||||||
exit! 1
|
exit! 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user