lib/childprocess/jruby/process.rb in childprocess-0.2.2 vs lib/childprocess/jruby/process.rb in childprocess-0.2.3
- old
+ new
@@ -50,16 +50,15 @@
private
def launch_process(&blk)
pb = java.lang.ProcessBuilder.new(@args)
- pb.directory(java.io.File.new(Dir.pwd))
- env = pb.environment
- ENV.each { |k,v| env.put(k, v) }
- @process = pb.start
+ pb.directory java.io.File.new(Dir.pwd)
+ set_env pb.environment
+ @process = pb.start
setup_io
end
def setup_io
if @io
@@ -83,9 +82,14 @@
return
end
output = output.to_outputstream
Thread.new { Redirector.new(input, output).run }
+ end
+
+ def set_env(env)
+ ENV.each { |k,v| env.put(k, v) } # not sure why this is needed
+ @environment.each { |k,v| env.put(k.to_s, v.to_s) }
end
end # Process
end # JRuby
end # ChildProcess