lib/childprocess/jruby/process.rb in childprocess-0.1.5 vs lib/childprocess/jruby/process.rb in childprocess-0.1.6

- old
+ new

@@ -28,26 +28,33 @@ @exit_code = @process.exitValue end private - def launch_process + def launch_process(&blk) pb = java.lang.ProcessBuilder.new(@args) env = pb.environment ENV.each { |k,v| env.put(k, v) } @process = pb.start + setup_io end def setup_io if @io redirect @process.getErrorStream, @io.stderr redirect @process.getInputStream, @io.stdout else @process.getErrorStream.close @process.getInputStream.close + end + + if duplex? + io._stdin = @process.getOutputStream.to_io + else + @process.getOutputStream.close end end def redirect(input, output) if output.nil?