aboutsummaryrefslogtreecommitdiffstats
path: root/lib/alaveteli_external_command.rb
diff options
context:
space:
mode:
authorIan Chard <ian@mysociety.org>2014-01-14 10:12:05 +0000
committerIan Chard <ian@mysociety.org>2014-01-14 10:12:05 +0000
commit3f33ccf5cf9dc1c9735cb4830198ccf1e6242e3b (patch)
treef68b1be93a1307be31c3e5f6072b2bdd6f7c0947 /lib/alaveteli_external_command.rb
parent0c1ce0ab10bb3a2d32a4b8ae08f57051b23be861 (diff)
Make sure to detect abnormal exits before looking at exit code
Diffstat (limited to 'lib/alaveteli_external_command.rb')
-rw-r--r--lib/alaveteli_external_command.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb
index fa2512387..086a461c8 100644
--- a/lib/alaveteli_external_command.rb
+++ b/lib/alaveteli_external_command.rb
@@ -44,15 +44,15 @@ module AlaveteliExternalCommand
end
xc.run(opts[:stdin_string] || "", opts[:env] || {})
- if xc.status != 0
+ if !xc.exited
+ # Crash or timeout
+ $stderr.puts("#{program_name} #{args.join(' ')}:exited abnormally")
+ return nil
+ elsif xc.status != 0
# Error
$stderr.puts("Error from #{program_name} #{args.join(' ')}:")
$stderr.print(xc.err)
return nil
- elsif !xc.exited
- # Crash or timeout
- $stderr.puts("#{program_name} #{args.join(' ')} exited abnormally")
- return nil
else
if opts.has_key? :append_to
opts[:append_to] << "\n\n"