lib/grit/git.rb in gitlab-grit-2.7.0 vs lib/grit/git.rb in gitlab-grit-2.7.1
- old
+ new
@@ -21,18 +21,22 @@
attr_reader :command
# The integer exit status.
attr_reader :exitstatus
+ # Everything output on the command's stdout as a String.
+ attr_reader :out
+
# Everything output on the command's stderr as a String.
attr_reader :err
- def initialize(command, exitstatus=nil, err='')
+ def initialize(command, exitstatus=nil, err='', out='')
if exitstatus
@command = command
@exitstatus = exitstatus
@err = err
+ @out = out
message = "Command failed [#{exitstatus}]: #{command}"
message << "\n\n" << err unless err.nil? || err.empty?
super message
else
super command
@@ -342,10 +346,10 @@
Grit.log(process.out) if Grit.debug
Grit.log(process.err) if Grit.debug
status = process.status
if raise_errors && !status.success?
- raise CommandFailed.new(argv.join(' '), status.exitstatus, process.err)
+ raise CommandFailed.new(argv.join(' '), status.exitstatus, process.err, process.out)
elsif process_info
[status.exitstatus, process.out, process.err]
else
process.out
end