diff --git a/plugins/git4idea/src/git4idea/commands/GitHandler.java b/plugins/git4idea/src/git4idea/commands/GitHandler.java index 3fe591e38d62..5bee0181b257 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandler.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandler.java @@ -20,6 +20,7 @@ import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.SystemInfo; @@ -480,6 +481,9 @@ public abstract class GitHandler { myProcess = startProcess(); startHandlingStreams(); } + catch (ProcessCanceledException pce) { + cleanupEnv(); + } catch (Throwable t) { if (!ApplicationManager.getApplication().isUnitTestMode() || !myProject.isDisposed()) { LOG.error(t); // will surely happen if called during unit test disposal, because the working dir is simply removed then