PY-18021 Python Unit tests do not work with active winpty-agent.exe console on Window...
authorAlexey Utkin <alexey.utkin@jetbrains.com>
Tue, 12 Jan 2016 10:24:49 +0000 (13:24 +0300)
committerAlexey Utkin <alexey.utkin@jetbrains.com>
Tue, 12 Jan 2016 10:24:49 +0000 (13:24 +0300)
python/src/com/jetbrains/python/run/AbstractPythonRunConfiguration.java
python/src/com/jetbrains/python/run/PythonProcessHandler.java
python/src/com/jetbrains/python/testing/AbstractPythonTestRunConfiguration.java

index 190cc2f23c7571977adcebdb15dde757ffd118ff..753c5616dcdce4ff827b7556c30468bdf31e5c3a 100644 (file)
@@ -469,8 +469,4 @@ public abstract class AbstractPythonRunConfiguration<T extends AbstractRunConfig
   public boolean isCompileBeforeLaunchAddedByDefault() {
     return false;
   }
-
-  public boolean usePty() {
-    return PtyCommandLine.isEnabled();
-  }
 }
index bbe75c0d1667fbb433afcd07400c836155c4b716..06897647f08f663192f2b95d35ff06e723b5cd5f 100644 (file)
@@ -17,11 +17,7 @@ package com.jetbrains.python.run;
 
 import com.intellij.execution.ExecutionException;
 import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.configurations.PtyCommandLine;
 import com.intellij.execution.process.KillableColoredProcessHandler;
-import com.intellij.execution.process.ProcessAdapter;
-import com.intellij.execution.process.ProcessEvent;
-import com.intellij.openapi.util.SystemInfo;
 import com.intellij.openapi.util.registry.Registry;
 import org.jetbrains.annotations.NotNull;
 
@@ -39,24 +35,14 @@ public class PythonProcessHandler extends KillableColoredProcessHandler {
 
   public PythonProcessHandler(@NotNull GeneralCommandLine commandLine, boolean softKillOnWin) throws ExecutionException {
     super(commandLine, softKillOnWin);
-    setupPtyIfNeed(commandLine);
   }
 
   public PythonProcessHandler(Process process, @NotNull String commandLine, @NotNull Charset charset) {
     super(process, commandLine, charset);
   }
 
-  private void setupPtyIfNeed(@NotNull GeneralCommandLine commandLine) {
-    boolean usePty = commandLine instanceof PtyCommandLine;
-    if (usePty && SystemInfo.isWindows) {
-      // winpty_close() must be always called, otherwise winpty-agent.exe is going to be left running
-      addProcessListener(new ProcessAdapter() {
-        @Override
-        public void processTerminated(ProcessEvent event) {
-          getProcess().destroy();
-        }
-      });
-    }
-    setShouldDestroyProcessRecursively(!usePty);
+  @Override
+  protected boolean shouldDestroyProcessRecursively() {
+    return true;
   }
 }
index 4636e90af13ec545370137eecd2191f4b3dbd963..f79fbb400adbfdf898b015c9530f32e058f69258 100644 (file)
@@ -360,10 +360,4 @@ public abstract class AbstractPythonTestRunConfiguration extends AbstractPythonR
   private static boolean pathsEqual(VirtualFile vFile, final String folderName) {
     return Comparing.equal(new File(vFile.getPath()).getAbsolutePath(), new File(folderName).getAbsolutePath());
   }
-
-  @Override
-  public boolean usePty() {
-    // parsing of test output is easier without colors. Less problems with the process crash.
-    return false;
-  }
 }