From 1117641d950a7d58788e87acb9678a62854fd89f Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 4 May 2020 20:30:49 +0200 Subject: [PATCH] [vfs] more reliable fsnotifier termination (IDEA-239103) GitOrigin-RevId: 89f5fd26fcbcfe03a52c41e50bf1d30113ed4591 --- .../openapi/vfs/impl/local/NativeFileWatcherImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java index 66f0aa241918..84829400ca38 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/NativeFileWatcherImpl.java @@ -216,12 +216,18 @@ public final class NativeFileWatcherImpl extends PluggableFileWatcher { try { writeLine(EXIT_COMMAND); } catch (IOException ignore) { } if (!processHandler.waitFor(10)) { - ApplicationManager.getApplication().executeOnPooledThread(() -> { + Runnable r = () -> { if (!processHandler.waitFor(500)) { LOG.warn("File watcher is still alive. Doing a force quit."); processHandler.destroyProcess(); } - }); + }; + if (myIsShuttingDown) { + new Thread(r, "fsnotifier shutdown").start(); + } + else { + ApplicationManager.getApplication().executeOnPooledThread(r); + } } }