mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
Added a registry key for default graceful stopping of processes on Windows (PY-17252)
This commit is contained in:
@@ -481,6 +481,7 @@ editor.injected.highlighting.enabled=true
|
||||
editor.injected.highlighting.enabled.description=Disables injected fragments highlighting (requires project reopening)
|
||||
|
||||
run.processes.with.pty=false
|
||||
kill.windows.processes.softly=false
|
||||
output.reader.blocking.mode=false
|
||||
|
||||
ide.certificate.manager=true
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class RestCommandLineState extends PythonCommandLineState {
|
||||
|
||||
protected ProcessHandler doCreateProcess(GeneralCommandLine commandLine) throws ExecutionException {
|
||||
final Runnable afterTask = getAfterTask();
|
||||
ProcessHandler processHandler = PythonProcessRunner.createProcess(commandLine);
|
||||
ProcessHandler processHandler = PythonProcessRunner.createProcess(commandLine, false);
|
||||
if (afterTask != null) {
|
||||
processHandler.addProcessListener(new ProcessAdapter() {
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
|
||||
@@ -133,7 +133,7 @@ public class SphinxBaseCommand {
|
||||
|
||||
private ProcessHandler createProcess(Module module) throws ExecutionException {
|
||||
GeneralCommandLine commandLine = createCommandLine(module, Collections.<String>emptyList());
|
||||
ProcessHandler handler = PythonProcessRunner.createProcess(commandLine);
|
||||
ProcessHandler handler = PythonProcessRunner.createProcess(commandLine, false);
|
||||
ProcessTerminatedListener.attach(handler);
|
||||
return handler;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jetbrains.python.run;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.KillableColoredProcessHandler;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@@ -26,8 +27,14 @@ import java.nio.charset.Charset;
|
||||
* @author traff
|
||||
*/
|
||||
public class PythonProcessHandler extends KillableColoredProcessHandler {
|
||||
public static final boolean SOFT_KILL_ON_WIN = Registry.get("kill.windows.processes.softly").asBoolean();
|
||||
|
||||
protected PythonProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
|
||||
super(commandLine);
|
||||
this(commandLine, SOFT_KILL_ON_WIN);
|
||||
}
|
||||
|
||||
public PythonProcessHandler(@NotNull GeneralCommandLine commandLine, boolean softKillOnWin) throws ExecutionException {
|
||||
super(commandLine, softKillOnWin);
|
||||
}
|
||||
|
||||
public PythonProcessHandler(Process process, String commandLine, @NotNull Charset charset) {
|
||||
@@ -38,10 +45,4 @@ public class PythonProcessHandler extends KillableColoredProcessHandler {
|
||||
protected boolean shouldDestroyProcessRecursively() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static PythonProcessHandler createProcessHandler(@NotNull GeneralCommandLine commandLine)
|
||||
throws ExecutionException {
|
||||
|
||||
return new PythonProcessHandler(commandLine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package com.jetbrains.python.run;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.process.RunnerMediator;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.jetbrains.python.sdk.flavors.JythonSdkFlavor;
|
||||
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
|
||||
|
||||
@@ -30,22 +28,18 @@ public class PythonProcessRunner {
|
||||
private PythonProcessRunner() {
|
||||
}
|
||||
|
||||
public static ProcessHandler createProcess(GeneralCommandLine commandLine, boolean withMediator) throws ExecutionException {
|
||||
public static ProcessHandler createProcess(GeneralCommandLine commandLine, boolean softKillOnWin) throws ExecutionException {
|
||||
if (PythonSdkFlavor.getFlavor(commandLine.getExePath()) instanceof JythonSdkFlavor) {
|
||||
return JythonProcessHandler.createProcessHandler(commandLine);
|
||||
}
|
||||
else {
|
||||
if (withMediator && SystemInfo.isWindows) {
|
||||
return RunnerMediator.getInstance().createProcess(commandLine);
|
||||
}
|
||||
else {
|
||||
return PythonProcessHandler.createProcessHandler(commandLine);
|
||||
}
|
||||
|
||||
return new PythonProcessHandler(commandLine, softKillOnWin);
|
||||
}
|
||||
}
|
||||
|
||||
public static ProcessHandler createProcess(GeneralCommandLine commandLine) throws ExecutionException {
|
||||
return createProcess(commandLine, false);
|
||||
return createProcess(commandLine, PythonProcessHandler.SOFT_KILL_ON_WIN);
|
||||
}
|
||||
|
||||
public static ProcessHandler createProcessHandlingCtrlC(GeneralCommandLine commandLine) throws ExecutionException {
|
||||
|
||||
Reference in New Issue
Block a user