forked from j62/ctbrec
1
0
Fork 0

Make sure to actually start the stream redirect threads

This commit is contained in:
0xb00bface 2020-10-31 15:09:34 +01:00
parent dfb1083c45
commit 2dbc6015d2
1 changed files with 6 additions and 6 deletions

View File

@ -47,14 +47,13 @@ public class ExternalBrowser implements AutoCloseable {
addProxyConfig(jsonConfig.getJSONObject("config")); addProxyConfig(jsonConfig.getJSONObject("config"));
if (LOG.isTraceEnabled()) {
p = new ProcessBuilder(OS.getBrowserCommand("--enable-logging")).start();
new StreamRedirectThread(p.getInputStream(), System.err);
new StreamRedirectThread(p.getErrorStream(), System.err);
} else {
p = new ProcessBuilder(OS.getBrowserCommand()).start(); p = new ProcessBuilder(OS.getBrowserCommand()).start();
new StreamRedirectThread(p.getInputStream(), OutputStream.nullOutputStream()); if (LOG.isTraceEnabled()) {
new StreamRedirectThread(p.getErrorStream(), OutputStream.nullOutputStream()); new Thread(new StreamRedirectThread(p.getInputStream(), System.out)).start();
new Thread(new StreamRedirectThread(p.getErrorStream(), System.err)).start();
} else {
new Thread(new StreamRedirectThread(p.getInputStream(), OutputStream.nullOutputStream())).start();
new Thread(new StreamRedirectThread(p.getErrorStream(), OutputStream.nullOutputStream())).start();
} }
LOG.debug("Browser started"); LOG.debug("Browser started");
@ -95,6 +94,7 @@ public class ExternalBrowser implements AutoCloseable {
out = socket.getOutputStream(); out = socket.getOutputStream();
reader = new Thread(this::readBrowserOutput); reader = new Thread(this::readBrowserOutput);
reader.start(); reader.start();
LOG.debug("Connected to control socket");
return; return;
} catch (IOException e) { } catch (IOException e) {
if(i == 19) { if(i == 19) {