lib/guard/rails/runner.rb in guard-rails-0.3.0 vs lib/guard/rails/runner.rb in guard-rails-0.3.1
- old
+ new
@@ -32,29 +32,29 @@
stop
start
end
def build_rails_command
- return %{sh -c 'cd #{Dir.pwd} && #{options[:CLI]} --pid #{pid_file} &'} if options[:CLI]
+ return %{#{options[:CLI]} --pid #{pid_file}} if options[:CLI]
rails_options = [
- options[:daemon] && '-d',
- options[:debugger] && '-u',
+ options[:daemon] ? '-d' : nil,
+ options[:debugger] ? '-u' : nil,
'-e', options[:environment],
'--pid', pid_file,
'-p', options[:port],
- options[:server] || '',
+ options[:server],
]
zeus_options = [
options[:zeus_plan] || 'server',
]
# omit env when use zeus
rails_runner = options[:zeus] ? "zeus #{zeus_options.join(' ')}" : "RAILS_ENV=#{options[:environment]} rails server"
- %{sh -c 'cd #{Dir.pwd} && #{rails_runner} #{rails_options.join(' ')} &'}
+ %{#{rails_runner} #{rails_options.join(' ')}}
end
def pid_file
File.expand_path(options[:pid_file] || "tmp/pids/#{options[:environment]}.pid")
end
@@ -67,10 +67,10 @@
options[:timeout].to_f / MAX_WAIT_COUNT.to_f
end
private
def run_rails_command!
- system build_rails_command
+ system "sh -c '#{build_rails_command}'"
end
def has_pid?
File.file?(pid_file)
end