From a0305cd36f9fc9412c8a1505f0889279eb2c65e7 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 5 Dec 2009 02:02:28 +0100 Subject: [PATCH] Try to handle the case where we cannot exec gnupg --- pws | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pws b/pws index c7d740c..4a3b0ad 100755 --- a/pws +++ b/pws @@ -90,7 +90,12 @@ class GnuPG STDIN.reopen(inR) STDOUT.reopen(outW) STDERR.reopen(errW) - exec(GNUPG, "--status-fd=#{statW.fileno}", *args) + begin + exec(GNUPG, "--status-fd=#{statW.fileno}", *args) + rescue Exception => e + outW.puts("[PWSEXECERROR]: #{e}") + exit(1) + end raise ("Calling gnupg failed") end inR.close @@ -102,6 +107,10 @@ class GnuPG throw "Unexpected pid: #{pid} vs #{wpid}" unless pid == wpid throw "Process has not exited!?" unless status.exited? throw "gpg call did not exit sucessfully" if (require_success and status.exitstatus != 0) + if m=/^\[PWSEXECERROR\]: (.*)/.match(outtxt) then + STDERR.puts "Could not run GnuPG: #{m[1]}" + exit(1) + end return outtxt, stderrtxt, statustxt, status.exitstatus end -- 2.39.5