lib/ruby_gpg.rb in ruby_gpg-0.3.1 vs lib/ruby_gpg.rb in ruby_gpg-0.3.2

- old
+ new

@@ -54,15 +54,16 @@ private def run_command(command, input = nil) output = "" - Open3.popen3(command) do |stdin, stdout, stderr| + Open3.popen3(command) do |stdin, stdout, stderr, wait_thr| stdin.write(input) if input stdin.close output << stdout.read + exitcode = wait_thr.value.exitstatus error = stderr.read - if error && !error.empty? + if exitcode != 0 raise "GPG command (#{command}) failed with: #{error}" end end output end