pass basedir along to the runner script
This commit is contained in:
1 parent
fbdde3e62a
commit
550adc8070
1 file changed
+7
-8
@@ -16,10 +16,8 @@ class Foreman::Process
|
|||||||
end
|
end
|
||||||
|
|
||||||
def run(pipe, basedir, environment)
|
def run(pipe, basedir, environment)
|
||||||
Dir.chdir(basedir) do
|
with_environment(environment.merge("PORT" => port.to_s)) do
|
||||||
with_environment(environment.merge("PORT" => port.to_s)) do
|
run_process basedir, entry.command, pipe
|
||||||
run_process entry.command, pipe
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -33,11 +31,12 @@ private
|
|||||||
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
||||||
end
|
end
|
||||||
|
|
||||||
def fork_with_io(command)
|
def fork_with_io(command, basedir)
|
||||||
reader, writer = IO.pipe
|
reader, writer = IO.pipe
|
||||||
command = replace_command_env(command)
|
command = replace_command_env(command)
|
||||||
pid = if jruby?
|
pid = if jruby?
|
||||||
Spoon.spawnp Foreman.runner, command
|
Spoon.spawnp Foreman.runner, command
|
||||||
|
Spoon.spawnp Foreman.runner, "-d", basedir, command
|
||||||
else
|
else
|
||||||
fork do
|
fork do
|
||||||
trap("INT", "IGNORE")
|
trap("INT", "IGNORE")
|
||||||
@@ -45,14 +44,14 @@ private
|
|||||||
$stdout.reopen writer
|
$stdout.reopen writer
|
||||||
$stderr.reopen writer
|
$stderr.reopen writer
|
||||||
reader.close
|
reader.close
|
||||||
exec Foreman.runner, command
|
exec Foreman.runner, "-d", basedir, command
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
[ reader, pid ]
|
[ reader, pid ]
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_process(command, pipe)
|
def run_process(basedir, command, pipe)
|
||||||
io, @pid = fork_with_io(command)
|
io, @pid = fork_with_io(command, basedir)
|
||||||
output pipe, "started with pid %d" % @pid
|
output pipe, "started with pid %d" % @pid
|
||||||
Thread.new do
|
Thread.new do
|
||||||
until io.eof?
|
until io.eof?
|
||||||
|
|||||||
Reference in new issue
Block a user