diff --git a/src/main/java/com/leinardi/pycharm/mypy/util/Async.java b/src/main/java/com/leinardi/pycharm/mypy/util/Async.java index a91d8c2..177d45d 100644 --- a/src/main/java/com/leinardi/pycharm/mypy/util/Async.java +++ b/src/main/java/com/leinardi/pycharm/mypy/util/Async.java @@ -17,6 +17,7 @@ package com.leinardi.pycharm.mypy.util; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,7 +48,12 @@ public static Future executeOnPooledThread(final Callable callable) { public static Future whenFinished(final Future future) { while (!future.isDone() && !future.isCancelled()) { - ProgressManager.checkCanceled(); + try { + ProgressManager.checkCanceled(); + } catch (ProcessCanceledException e) { + future.cancel(true); + throw e; + } waitFor(FIFTY_MS); } return future;