[vfs] more reliable fsnotifier termination (IDEA-239103)

GitOrigin-RevId: 89f5fd26fcbcfe03a52c41e50bf1d30113ed4591
This commit is contained in:
Roman Shevchenko
2020-05-04 18:46:22 +00:00
committed by intellij-monorepo-bot
parent 9185e79e7b
commit 1117641d95
@@ -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);
}
}
}