Permalink
Browse files

Exit with non-zero return code for error condition

  • Loading branch information...
1 parent 7097128 commit 3357244db35a22c15da761079cbb30cea2f4240f @hennk hennk committed with Oct 26, 2009
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/action_mailer/ar_sendmail.rb
@@ -282,7 +282,7 @@ def self.run(args = ARGV)
File.open(@@pid_file, 'r') {|f| pid = f.read.chomp }
if system("ps -p #{pid} | grep #{pid}") # returns true if process is running, o.w. false
$stderr.puts "Warning: The pid file #{@@pid_file} exists and ar_sendmail is running. Shutting down."
- exit
+ exit -1
else
# not running, so remove existing pid file and continue
self.remove_pid_file
@@ -302,7 +302,7 @@ def self.run(args = ARGV)
rescue Exception => e
$stderr.puts "Unhandled exception #{e.message}(#{e.class}):"
$stderr.puts "\t#{e.backtrace.join "\n\t"}"
- exit 1
+ exit -2
end
##
@@ -417,7 +417,7 @@ def deliver(emails)
def do_exit
log "caught signal, shutting down"
self.class.remove_pid_file
- exit
+ exit 130
end
##

0 comments on commit 3357244

Please sign in to comment.