lib/tasks_scheduler/daemon.rb in tasks_scheduler-0.0.5 vs lib/tasks_scheduler/daemon.rb in tasks_scheduler-0.0.6

- old
+ new

@@ -15,13 +15,15 @@ end def execute(action) raise "Action not allowed: #{action} (Allowed: #{ACTIONS})" unless ACTIONS.include?(action) command = ['bundle', 'exec', 'tasks_scheduler', action] + env_args = { 'RAILS_ENV' => Rails.env } Dir.chdir(Rails.root) do - Open3.popen3(*command) do |_stdin, stdout, stderr, wait_thr| - { action: action, command: command.join(' '), status: wait_thr.value.to_i, - stdout: stdout.read, stderr: stderr.read } + Open3.popen3(env_args, *command) do |_stdin, stdout, stderr, wait_thr| + { action: action, env_args: env_args.map { |k, v| "#{k}=#{v}" }.join(' | '), + command: command.join(' '), status: wait_thr.value.to_i, stdout: stdout.read, + stderr: stderr.read } end end end def running?