PY-32807 Fix reader options for debug processes

GitOrigin-RevId: f812168b3e7aa862795f3a7021b306723998a1fa
This commit is contained in:
Elizaveta Shashkova
2019-11-20 16:07:01 +00:00
committed by intellij-monorepo-bot
parent a602d71b16
commit 5907d1db62
2 changed files with 21 additions and 1 deletions
@@ -0,0 +1,12 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.run
import com.intellij.execution.configurations.GeneralCommandLine
import com.intellij.util.io.BaseOutputReader
class PyDebugProcessHandler(commandLine: GeneralCommandLine, softKillOnWin: Boolean) : PythonProcessHandler(commandLine, softKillOnWin) {
override fun readerOptions(): BaseOutputReader.Options {
return BaseOutputReader.Options.forMostlySilentProcess()
}
}
@@ -17,6 +17,7 @@ package com.jetbrains.python.run;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.ParamsGroup;
import com.intellij.execution.process.ProcessHandler;
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor;
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
@@ -33,7 +34,9 @@ public class PythonProcessRunner {
return JythonProcessHandler.createProcessHandler(commandLine);
}
else {
if (isUnderDebugger(commandLine)) {
return new PyDebugProcessHandler(commandLine, softKillOnWin);
}
return new PythonProcessHandler(commandLine, softKillOnWin);
}
}
@@ -45,4 +48,9 @@ public class PythonProcessRunner {
public static ProcessHandler createProcessHandlingCtrlC(GeneralCommandLine commandLine) throws ExecutionException {
return createProcess(commandLine, true);
}
private static boolean isUnderDebugger(GeneralCommandLine commandLine) {
ParamsGroup debugParams = commandLine.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_DEBUGGER);
return debugParams != null && debugParams.getParameters().size() > 0;
}
}