Skip to content

Commit fa7d32f

Browse files
committed
Read stdout/stderr of child process on JRuby
Closes #4453
1 parent ac0a5b5 commit fa7d32f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rb/lib/selenium/webdriver/common/service.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,12 @@ def uri
9292
def build_process(*command)
9393
WebDriver.logger.debug("Executing Process #{command}")
9494
@process = ChildProcess.build(*command)
95-
@process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug?
95+
if WebDriver.logger.debug?
96+
@process.io.stdout = @process.io.stderr = WebDriver.logger.io
97+
elsif Platform.jruby?
98+
# Apparently we need to read the output of drivers on JRuby.
99+
@process.io.stdout = @process.io.stderr = File.new(Platform.null_device, 'w')
100+
end
96101

97102
@process
98103
end
@@ -117,6 +122,7 @@ def start_process
117122
def stop_process
118123
return if process_exited?
119124
@process.stop STOP_TIMEOUT
125+
@process.io.stdout.close if Platform.jruby? && !WebDriver.logger.debug?
120126
end
121127

122128
def stop_server

0 commit comments

Comments
 (0)