Try to kill Git processes softly

To avoid leaving index.lock file, and to lessen the possibility
of repository corruption.

IDEA-148376
This commit is contained in:
Kirill Likhodedov
2016-09-27 20:07:32 +03:00
parent d64c5aebda
commit 6a40bdd2b8
@@ -17,10 +17,7 @@ package git4idea.commands;
import com.intellij.execution.ExecutionException; import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.OSProcessHandler; import com.intellij.execution.process.*;
import com.intellij.execution.process.ProcessEvent;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.execution.process.ProcessListener;
import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.ProgressManager;
@@ -142,9 +139,9 @@ public abstract class GitTextHandler extends GitHandler {
return new MyOSProcessHandler(commandLine); return new MyOSProcessHandler(commandLine);
} }
private static class MyOSProcessHandler extends OSProcessHandler { private static class MyOSProcessHandler extends KillableColoredProcessHandler {
private MyOSProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException { private MyOSProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
super(commandLine); super(commandLine, true);
} }
@NotNull @NotNull
@@ -159,5 +156,4 @@ public abstract class GitTextHandler extends GitHandler {
return Registry.is("git.blocking.read") ? BaseOutputReader.Options.BLOCKING : BaseOutputReader.Options.NON_BLOCKING; return Registry.is("git.blocking.read") ? BaseOutputReader.Options.BLOCKING : BaseOutputReader.Options.NON_BLOCKING;
} }
} }
} }