Skip to content

Commit

Permalink
Fix exit status problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalmer committed Jul 4, 2014
1 parent 0534ef8 commit b8c91ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/lvm/vg_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ def vgcfgbackup_output
cmd = "#{@vgcfgbackup_cmd} -f #{tmpf.path} #{@vg_name}"
stdout = nil
stderr = nil
Open3.popen3(cmd) do |stdin_fd, stdout_fd, stderr_fd|
exit_status = nil

Open3.popen3(cmd) do |stdin_fd, stdout_fd, stderr_fd, wait_thr|
stdin_fd.close
stdout = stdout_fd.read
stderr = stderr_fd.read
exit_status = wait_thr.value
end

if $?.exitstatus != 0
if exit_status.exitstatus != 0
raise RuntimeError,
"Failed to run vgcfgbackup: #{stdout}\n#{stderr}"
end
Expand Down

0 comments on commit b8c91ae

Please sign in to comment.