aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-06-03 17:18:21 +0100
committerLouise Crow <louise.crow@gmail.com>2013-06-03 17:18:21 +0100
commitfc7fc117008be617cad6d546e0e1319767a0331f (patch)
treea1dc1241d5c28a36c1c4821eefc663152942115b
parente503bf89c973dad5bdbffb3e2ec4d15cf063bf91 (diff)
Replace backticks with call to exec(), the former spawns a new process, and the latter replaces the current process. In the daemon context we care about the process id so that calls to startstopdaemon won't spawn a new daemon.
-rwxr-xr-xscript/runner5
1 files changed, 3 insertions, 2 deletions
diff --git a/script/runner b/script/runner
index 73b03847d..32a0e6b7e 100755
--- a/script/runner
+++ b/script/runner
@@ -19,12 +19,13 @@ Dir.chdir(alaveteli_dir) do
# Load the runner in a subprocess
pid = fork do
- `bundle exec rails runner #{ARGV[1]}`
+ exec("bundle exec rails runner #{ARGV[1]}")
exit 0
end
# If the environment variable PIDFILE is present,
# write the pid of the daemon process to that file.
+
if ENV.has_key? "PIDFILE"
File.open(ENV["PIDFILE"], 'w') do |fh|
fh.puts pid
@@ -34,6 +35,6 @@ Dir.chdir(alaveteli_dir) do
Process.detach(pid)
else
# Not daemon mode
- `bundle exec rails runner #{ARGV[1]}`
+ exec("bundle exec rails runner #{ARGV[1]}")
end
end