[platform] optimization: use "redirect error stream" flag from the command line

This commit is contained in:
Roman Shevchenko
2016-04-14 20:47:53 +02:00
parent 30cbf8b772
commit 18f4b61d71
2 changed files with 11 additions and 4 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -96,7 +96,7 @@ public class GeneralCommandLine implements UserDataHolder {
private ParentEnvironmentType myParentEnvironmentType = ParentEnvironmentType.CONSOLE;
private final ParametersList myProgramParams = new ParametersList();
private Charset myCharset = CharsetToolkit.getDefaultSystemCharset();
private boolean myRedirectErrorStream;
private boolean myRedirectErrorStream = false;
private Map<Object, Object> myUserData;
public GeneralCommandLine() { }
@@ -437,7 +437,7 @@ public class GeneralCommandLine implements UserDataHolder {
private static class MyTHashMap extends THashMap<String, String> {
private MyTHashMap() {
super(SystemInfo.isWindows ? CaseInsensitiveStringHashingStrategy.INSTANCE : ContainerUtil.<String>canonicalStrategy());
super(SystemInfo.isWindows ? CaseInsensitiveStringHashingStrategy.INSTANCE : ContainerUtil.canonicalStrategy());
}
@Override
@@ -461,4 +461,4 @@ public class GeneralCommandLine implements UserDataHolder {
}
}
}
}
}
@@ -31,11 +31,13 @@ import java.util.concurrent.Future;
public class OSProcessHandler extends BaseOSProcessHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.process.OSProcessHandler");
private boolean myHasErrorStream = true;
private boolean myHasPty;
private boolean myDestroyRecursively = true;
public OSProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
this(commandLine.createProcess(), commandLine.getCommandLineString(), commandLine.getCharset());
myHasErrorStream = !commandLine.isRedirectErrorStream();
setHasPty(commandLine instanceof PtyCommandLine);
}
@@ -65,6 +67,11 @@ public class OSProcessHandler extends BaseOSProcessHandler {
return super.executeOnPooledThread(task); // to maintain binary compatibility?
}
@Override
protected boolean processHasSeparateErrorStream() {
return myHasErrorStream;
}
protected boolean shouldDestroyProcessRecursively() {
// Override this method if you want to kill process recursively (whole process try) by default
// such behaviour is better than default java one, which doesn't kill children processes