summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-12-14 16:17:14 -0800
committerelijah <elijah@riseup.net>2014-12-14 16:17:14 -0800
commit92db2c6e6210a860a4de4baf8033428fbe72b7cc (patch)
tree19cb97b35ed094d1a5f844cc4cebdf56dfed91e2 /bin
parent0eedbfa5ce7a8ed4799408b591e655070336f0cc (diff)
added TapiceroProcess, to handle starting and stopping tapicero during tests.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tapicero19
1 files changed, 13 insertions, 6 deletions
diff --git a/bin/tapicero b/bin/tapicero
index d3a9bf8..ef063e5 100755
--- a/bin/tapicero
+++ b/bin/tapicero
@@ -7,6 +7,13 @@
require 'pathname'
BASE_DIR = Pathname.new(__FILE__).realpath + '../..'
+def error(msg)
+ if Tapicero.respond_to?(:logger) && Tapicero.logger
+ Tapicero.logger.error(msg)
+ end
+ puts(msg)
+end
+
begin
#
# try without rubygems (might be already loaded or not present)
@@ -27,9 +34,8 @@ end
# Graceful Ctrl-C
Signal.trap("SIGINT") do
- Tapicero.logger.warn "Received SIGINT - stopping tapicero"
- puts "\nQuit - leaving tapicero"
- exit
+ error "Received SIGINT - stopping tapicero"
+ exit(0)
end
# this changes later, so save the initial current directory
@@ -69,7 +75,8 @@ end
begin
Daemons.run("#{BASE_DIR}/lib/tapicero_daemon.rb", options)
rescue SystemExit
-rescue Exception => exc
- puts exc.class.name + exc.to_s
- puts exc.backtrace.join("\n")
+ error "Bye"
+rescue StandardError => exc
+ error exc.class.name + " " + exc.to_s
+ error exc.backtrace.join("\n")
end