diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java index 0ea52e6..6fdc958 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/LaunchHelper.java @@ -4,14 +4,13 @@ import java.util.concurrent.CompletableFuture; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; public class LaunchHelper { - public static Job createJob(ILaunch launch, String command, String workingDirectory) { return createJob(launch, command, new File(workingDirectory)); } @@ -27,32 +26,28 @@ public static Job createJob(ILaunch launch, String command, File workingDirector } CompletableFuture future = process.onExit(); // initialize a process completion future to log any non-zero process exit - future.defaultExecutor().execute(new Runnable() { - @Override - public void run() { - try { - if (process.isAlive()) { - process.waitFor(); - } - } catch (InterruptedException e) { - LogHelper.cancelled("Process monitor interrupted: " + command); - return; - } - int exc = process.exitValue(); - if (exc != 0) { - String msg = String.format("Process exited non-zero (%d): %s ", exc, command); - LogHelper.error(msg); + future.defaultExecutor().execute(() -> { + try { + if (process.isAlive()) { + process.waitFor(); } + } catch (InterruptedException e) { + LogHelper.cancelled("Process monitor interrupted: " + command); + return; + } + int exc = process.exitValue(); + if (exc != 0) { + String msg = String.format("Process exited non-zero (%d): %s ", exc, command); + LogHelper.error(msg); } - }); DebugPlugin.newProcess(launch, process, command); } catch (CoreException e) { // CoreException from exec - LogHelper.log(Status.ERROR, "Exception when launching process: " + command, e); + LogHelper.log(IStatus.ERROR, "Exception when launching process: " + command, e); return; } }); } -};; +}