lib/rbbt/util/cmd.rb in rbbt-util-5.34.27 vs lib/rbbt/util/cmd.rb in rbbt-util-5.35.1

- old
+ new

@@ -110,10 +110,11 @@ no_fail = options.delete(:no_fail) no_fail = options.delete(:nofail) if no_fail.nil? no_wait = options.delete(:no_wait) xvfb = options.delete(:xvfb) bar = options.delete(:progress_bar) + save_stderr = options.delete(:save_stderr) dont_close_in = options.delete(:dont_close_in) log = true if log.nil? @@ -152,11 +153,11 @@ sin, sout, serr, wait_thr = begin Open3.popen3(ENV, cmd) rescue Log.warn $!.message - raise ProcessFailed, cmd unless no_fail + raise ProcessFailed, nil, cmd unless no_fail return end pid = wait_thr.pid Log.debug{"CMD: [#{pid}] #{cmd}" if log} @@ -196,10 +197,11 @@ if (Integer === stderr and log) || bar err_thread = Thread.new do while line = serr.gets bar.process(line) if bar sout.log = line + sout.std_err << line if save_stderr Log.log "STDERR [#{pid}]: " + line, stderr if log end serr.close end else @@ -242,12 +244,12 @@ sout.close unless sout.closed? status = wait_thr.value if not status.success? and not no_fail if !err.empty? - raise ProcessFailed.new "Command [#{pid}] #{cmd} failed with error status #{status.exitstatus}.\n#{err}" + raise ProcessFailed.new pid, "#{cmd} failed with error status #{status.exitstatus}.\n#{err}" else - raise ProcessFailed.new "Command [#{pid}] #{cmd} failed with error status #{status.exitstatus}" + raise ProcessFailed.new pid, "#{cmd} failed with error status #{status.exitstatus}" end else Log.log err, stderr if Integer === stderr and log end