def decrypt
(outtxt, stderrtxt, statustxt, exitstatus) = GnuPG.gpgcall(@encrypted_content, %w{--decrypt})
if !@new and exitstatus != 0
- proceed = read_input("Warning: gpg returned non-zero exit status #{exitstatus} when decrypting #{@filename}. Proceed?")
+ proceed = read_input("Warning: gpg returned non-zero exit status #{exitstatus} when decrypting #{@filename}. Proceed?", false)
exit(0) unless proceed
elsif !@new and outtxt.length == 0
proceed = read_input("Warning: #{@filename} decrypted to an empty file. Proceed?")
end
content = encrypted_file.decrypt
+ original_content = content
while true
oldsize = content.length
tempfile = Tempfile.open('pws')
exit(0) unless proceed
end
+ if (original_content == content)
+ proceed = read_input("Nothing changed. Re-encrypt anyway?", false)
+ exit(0) unless proceed
+ end
+
success = encrypted_file.write_back(content)
break if success
end