Skip to content

Commit

Permalink
Read stdout/stderr of child process on JRuby
Browse files Browse the repository at this point in the history
Closes #4453
  • Loading branch information
p0deje committed Aug 15, 2017
1 parent ac0a5b5 commit fa7d32f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rb/lib/selenium/webdriver/common/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ def uri
def build_process(*command)
WebDriver.logger.debug("Executing Process #{command}")
@process = ChildProcess.build(*command)
@process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug?
if WebDriver.logger.debug?
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
elsif Platform.jruby?
# Apparently we need to read the output of drivers on JRuby.
@process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w')
end

@process
end
Expand All @@ -117,6 +122,7 @@ def start_process
def stop_process
return if process_exited?
@process.stop STOP_TIMEOUT
@process.io.stdout.close if Platform.jruby? && !WebDriver.logger.debug?
end

def stop_server
Expand Down

0 comments on commit fa7d32f

Please sign in to comment.