Skip to content

Commit

Permalink
XpiDriverService should honour the same system property as ExtensionC…
Browse files Browse the repository at this point in the history
…onnection

This means that we should be sniffing the log file system
property, and if this is `/dev/stdout` we should output
the firefox logs to stdout. This is basically what
happens anyway, since DriverService logs to stderr anyway.
  • Loading branch information
shs96c committed Mar 26, 2017
1 parent f48a812 commit d566ed3
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.openqa.selenium.remote.service.DriverService;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.Optional;
Expand Down Expand Up @@ -61,6 +62,16 @@ private XpiDriverService(
this.port = port;
this.binary = binary;
this.profile = profile;

String firefoxLogFile = System.getProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE);

if (firefoxLogFile != null) {
if ("/dev/stdout".equals(firefoxLogFile)) {
sendOutputTo(System.out);
} else {
sendOutputTo(new FileOutputStream(firefoxLogFile));
}
}
}

@Override
Expand All @@ -74,8 +85,10 @@ public void start() throws IOException {
try {
profile.setPreference(PORT_PREFERENCE, port);
addWebDriverExtension(profile);

profileDir = profile.layoutOnDisk();

binary.setOutputWatcher(getOutputStream());

binary.startProfile(profile, profileDir, "-foreground");

waitUntilAvailable();
Expand Down

0 comments on commit d566ed3

Please sign in to comment.