lib/scout/command/run.rb in scout-5.6.0.alpha.4 vs lib/scout/command/run.rb in scout-5.6.0
- old
+ new
@@ -15,13 +15,18 @@
unless $stdin.tty?
log.info "Sleeping #{@scout.sleep_interval} sec" if log
sleep @scout.sleep_interval
end
-
- @scout.fetch_plan
+ begin
+ @scout.fetch_plan
+ rescue SystemExit => e
+ puts "Failure. Run with '-v -ldebug' for more information" if $stdin.tty?
+ raise e
+ end
+
# Spawn or stop streamer as needed
if @scout.streamer_command.is_a?(String)
if @scout.streamer_command.start_with?("start")
log.info "streamer command: start"
Scout::StreamerDaemon.start_daemon(history, @scout.streamer_command)
@@ -38,12 +43,19 @@
elsif @scout.time_to_checkin?
log.info("It is time to checkin") if log
elsif @force
log.info("overriding checkin schedule with --force and checking in now.") if log
end
- create_pid_file_or_exit
- @scout.run_plugins_by_plan
- @scout.save_history
+
+ begin
+ create_pid_file_or_exit
+ @scout.run_plugins_by_plan
+ @scout.save_history
+ puts "Successfully reported to #{server}" if $stdin.tty?
+ rescue SystemExit => e
+ puts "Failure. Run with '-v -ldebug' for more information" if $stdin.tty?
+ raise e
+ end
begin
# Since this is a new checkin, overwrite the existing log
File.open(log_path, "w") do|log_file|
log_file.puts log.messages # log.messages is an array of every message logged during this run