lib/rundock/backend.rb in rundock-1.1.5 vs lib/rundock/backend.rb in rundock-1.1.6
- old
+ new
@@ -57,10 +57,17 @@
Logger.debug(%(Start executing: "#{command}"))
return nil if exec_options[:dry_run]
- result = @backend.run_command(command)
+ begin
+ result = @backend.run_command(command)
+ rescue StandardError => e
+ Logger.error(e.to_s)
+ raise CommandResultStatusError if exec_options[:errexit]
+ return nil
+ end
+
exit_status = result.exit_status
Logger.formatter.indent do
Logger.debug("cwd: #{exec_options[:cwd]}") if exec_options[:cwd]
Logger.debug("sudo: #{exec_options[:sudo]}") if exec_options[:sudo]