Skip to content

Commit

Permalink
Workaround for corrupted tasklist command
Browse files Browse the repository at this point in the history
Signed-off-by: Snjezana Peco <[email protected]>
  • Loading branch information
snjeza authored and fbricon committed Mar 5, 2019
1 parent 470c0a4 commit ec52798
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public ParentProcessWatcher(LanguageServer server ) {
@Override
public void run() {
if (!parentProcessStillRunning()) {
JavaLanguageServerPlugin.logInfo("Parent process stopped running, forcing server exit");
task.cancel(true);
server.exit();
}
Expand Down Expand Up @@ -77,6 +78,11 @@ private boolean parentProcessStillRunning() {
process.destroy();
finished = process.waitFor(POLL_DELAY_SECS, TimeUnit.SECONDS); // wait for the process to stop
}
if (Platform.OS_WIN32.equals(Platform.getOS()) && finished && process.exitValue() > 1) {
// the tasklist command should return 0 (parent process exists) or 1 (parent process doesn't exist)
JavaLanguageServerPlugin.logInfo("The tasklist command: '" + command + "' returns " + process.exitValue());
return true;
}
return !finished || process.exitValue() == 0;
} catch (IOException | InterruptedException e) {
JavaLanguageServerPlugin.logException(e.getMessage(), e);
Expand Down

0 comments on commit ec52798

Please sign in to comment.