diff --git a/python/src/com/jetbrains/python/run/PyDebugProcessHandler.kt b/python/src/com/jetbrains/python/run/PyDebugProcessHandler.kt new file mode 100644 index 000000000000..d72b183388c1 --- /dev/null +++ b/python/src/com/jetbrains/python/run/PyDebugProcessHandler.kt @@ -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() + } +} \ No newline at end of file diff --git a/python/src/com/jetbrains/python/run/PythonProcessRunner.java b/python/src/com/jetbrains/python/run/PythonProcessRunner.java index eb4ce2051f7d..6d1d04fe5039 100644 --- a/python/src/com/jetbrains/python/run/PythonProcessRunner.java +++ b/python/src/com/jetbrains/python/run/PythonProcessRunner.java @@ -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; + } }