Skip to content

Commit b7ce984

Browse files
authored
Revert "fix: manually pipe messages from child process sdtout/stderr (microsoft#426)" (microsoft#440)
This reverts commit 0fa416b.
1 parent 47fe3aa commit b7ce984

3 files changed

Lines changed: 3 additions & 84 deletions

File tree

driver-bundle/src/test/java/com/microsoft/playwright/TestInstall.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.microsoft.playwright;
1818

1919
import com.microsoft.playwright.impl.Driver;
20-
import com.microsoft.playwright.impl.StreamRedirectThread;
2120
import org.junit.jupiter.api.Test;
2221

2322
import java.nio.file.Files;
@@ -37,13 +36,11 @@ void playwrightCliInstalled() throws Exception {
3736
assertTrue(Files.exists(cli));
3837

3938
ProcessBuilder pb = new ProcessBuilder(cli.toString(), "install");
39+
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
40+
pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
4041
Process p = pb.start();
41-
StreamRedirectThread stdoutThread = new StreamRedirectThread(p.getInputStream(), System.out);
42-
StreamRedirectThread stderrThread = new StreamRedirectThread(p.getErrorStream(), System.err);
4342
boolean result = p.waitFor(1, TimeUnit.MINUTES);
4443
assertTrue(result, "Timed out waiting for browsers to install");
45-
stderrThread.terminateAndJoin();
46-
stdoutThread.terminateAndJoin();
4744
} catch (Exception e) {
4845
e.printStackTrace();
4946
assertNull(e);

driver/src/main/java/com/microsoft/playwright/impl/StreamRedirectThread.java

Lines changed: 0 additions & 69 deletions
This file was deleted.

playwright/src/main/java/com/microsoft/playwright/impl/PlaywrightImpl.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,21 @@
2727

2828
public class PlaywrightImpl extends ChannelOwner implements Playwright {
2929
private Process driverProcess;
30-
private StreamRedirectThread stderrThread;
3130

3231
public static PlaywrightImpl create() {
33-
StreamRedirectThread stderrThread = null;
3432
try {
3533
Path driver = Driver.ensureDriverInstalled();
3634
ProcessBuilder pb = new ProcessBuilder(driver.toString(), "run-driver");
35+
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
3736
// pb.environment().put("DEBUG", "pw:pro*");
3837
Process p = pb.start();
39-
stderrThread = new StreamRedirectThread(p.getErrorStream(), System.err);
4038
Connection connection = new Connection(new PipeTransport(p.getInputStream(), p.getOutputStream()));
4139
PlaywrightImpl result = (PlaywrightImpl) connection.waitForObjectWithKnownName("Playwright");
4240
result.driverProcess = p;
43-
result.stderrThread = stderrThread;
44-
stderrThread = null;
4541
result.initSharedSelectors(null);
4642
return result;
4743
} catch (IOException e) {
4844
throw new PlaywrightException("Failed to launch driver", e);
49-
} finally {
50-
if (stderrThread != null) {
51-
stderrThread.terminateAndJoin();
52-
}
5345
}
5446
}
5547

@@ -111,7 +103,6 @@ public void close() {
111103
if (!didClose) {
112104
System.err.println("WARNING: Timed out while waiting for driver process to exit");
113105
}
114-
stderrThread.terminateAndJoin();
115106
} catch (IOException e) {
116107
throw new PlaywrightException("Failed to terminate", e);
117108
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)