Bug 444602 - Fix for debug launch regression
Change-Id: I34149db9cda877fa6fb66cf07859a2c0e81316bd
Signed-off-by: Greg Watson <g.watson@computer.org>
diff --git a/rms/org.eclipse.ptp.rm.jaxb.control.core/src/org/eclipse/ptp/internal/rm/jaxb/control/core/runnable/command/CommandJob.java b/rms/org.eclipse.ptp.rm.jaxb.control.core/src/org/eclipse/ptp/internal/rm/jaxb/control/core/runnable/command/CommandJob.java
index 37c3db5..034fa0e 100644
--- a/rms/org.eclipse.ptp.rm.jaxb.control.core/src/org/eclipse/ptp/internal/rm/jaxb/control/core/runnable/command/CommandJob.java
+++ b/rms/org.eclipse.ptp.rm.jaxb.control.core/src/org/eclipse/ptp/internal/rm/jaxb/control/core/runnable/command/CommandJob.java
@@ -274,12 +274,13 @@
int exit = 0;
if (uuid != null) {
if (!command.isWaitForId()) {
- try {
- // Must call waitFor() here to correctly obtain exit status. Calling exitValue() can result in a -1 value
- // being returned if the job has not completed.
- exit = process.waitFor();
- } catch (InterruptedException ignored) {
- // Ignore
+ /*
+ * Cannot call waitFor here as it will block if the process has not terminated. The best we can do is a check of
+ * the exit value if the process has completed. Some processes may not have completed by this point, so they
+ * will need to be checked later.
+ */
+ if (process.isCompleted()) {
+ exit = process.exitValue();
}
if (exit != 0) {
return processError(builder.command().get(0), exit, null);