Allow subclasses to access outputstream of driverservice
This means checking the system property for the log file, and if
this has been set to `/dev/stdout` making sure we copy all browser
output to stdout.
The default behaviour with the DriverService is to spool output
to stderr, so this isn't a radical change.
import static com.google.common.base.Preconditions.checkState;
import static java.util.concurrent.TimeUnit.SECONDS;
+import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -174,7 +175,7 @@ public void start() throws IOException {
}
process = new CommandLine(this.executable, args.toArray(new String[] {}));
process.setEnvironmentVariables(environment);
- process.copyOutputTo(outputStream);
+ process.copyOutputTo(getOutputStream());
process.executeAsync();
waitUntilAvailable();
@@ -229,7 +230,11 @@ public void stop() {
}
public void sendOutputTo(OutputStream outputStream) {
- this.outputStream = outputStream;
+ this.outputStream = Preconditions.checkNotNull(outputStream);
+ }
+
+ protected OutputStream getOutputStream() {
+ return outputStream;
}
public static abstract class Builder<DS extends DriverService, B extends Builder> {
