From 18f4b61d71490ffd823edc7c61cb3d98edef457f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 14 Apr 2016 20:47:53 +0200 Subject: [PATCH] [platform] optimization: use "redirect error stream" flag from the command line --- .../execution/configurations/GeneralCommandLine.java | 8 ++++---- .../com/intellij/execution/process/OSProcessHandler.java | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java b/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java index 4ba7a4a2acfd..f54c6130693c 100644 --- a/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java +++ b/platform/platform-api/src/com/intellij/execution/configurations/GeneralCommandLine.java @@ -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 myUserData; public GeneralCommandLine() { } @@ -437,7 +437,7 @@ public class GeneralCommandLine implements UserDataHolder { private static class MyTHashMap extends THashMap { private MyTHashMap() { - super(SystemInfo.isWindows ? CaseInsensitiveStringHashingStrategy.INSTANCE : ContainerUtil.canonicalStrategy()); + super(SystemInfo.isWindows ? CaseInsensitiveStringHashingStrategy.INSTANCE : ContainerUtil.canonicalStrategy()); } @Override @@ -461,4 +461,4 @@ public class GeneralCommandLine implements UserDataHolder { } } } -} +} \ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java b/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java index f9cfabbf2144..6289a1668a47 100644 --- a/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java +++ b/platform/platform-api/src/com/intellij/execution/process/OSProcessHandler.java @@ -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