lib/rundock/backend.rb in rundock-0.5.3 vs lib/rundock/backend.rb in rundock-0.5.4
- old
+ new
@@ -49,10 +49,11 @@
private
def run_command(cmd, exec_options = {})
command = cmd.strip
+ command = "sudo #{command.gsub(/^sudo +/, '')}" if exec_options[:sudo]
command = "cd #{Shellwords.escape(exec_options[:cwd])} && #{command}" if exec_options[:cwd]
command = "sudo -H -u #{Shellwords.escape(user)} -- /bin/sh -c #{command}" if exec_options[:user]
Logger.debug(%(Start executing: "#{command}"))
@@ -60,9 +61,11 @@
result = @backend.run_command(command)
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]
Logger.error("#{result.stderr.strip}") unless result.stderr.strip.blank?
Logger.info("#{result.stdout.strip}") unless result.stdout.strip.blank?
Logger.debug("errexit: #{exec_options[:errexit]}")
Logger.debug("exit status: #{exit_status}")
end