lib/io_streams/pgp/writer.rb in iostreams-1.10.1 vs lib/io_streams/pgp/writer.rb in iostreams-1.10.2
- old
+ new
@@ -87,14 +87,15 @@
recipients.each { |address| command << " --recipient \"#{address}\"" }
command << " -o \"#{file_name}\""
IOStreams::Pgp.logger&.debug { "IOStreams::Pgp::Writer.open: #{command}" }
+ result = nil
Open3.popen2e(command) do |stdin, out, waith_thr|
begin
stdin.binmode
- yield(stdin)
+ result = yield(stdin)
stdin.close
rescue Errno::EPIPE
# Ignore broken pipe because gpg terminates early due to an error
::File.delete(file_name) if ::File.exist?(file_name)
raise(Pgp::Failure, "GPG Failed writing to encrypted file: #{file_name}: #{out.read.chomp}")
@@ -102,9 +103,10 @@
unless waith_thr.value.success?
::File.delete(file_name) if ::File.exist?(file_name)
raise(Pgp::Failure, "GPG Failed to create encrypted file: #{file_name}: #{out.read.chomp}")
end
end
+ result
end
end
end
end