Skip to content

Commit 6fe428c

Browse files
committed
Call exitValue only if process completed
Otherwise this will throw an exception, making the check for completion irrelevant and possibly leaving a dangling process.
1 parent 819ffef commit 6fe428c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/net/imagej/ui/swing/updater/LauncherMigrator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,11 @@ private static List<String> collectProcessOutput(Process p)
534534
throws IOException, InterruptedException
535535
{
536536
boolean completed = p.waitFor(5, TimeUnit.SECONDS);
537-
p.exitValue();
538537
if (!completed) {
539538
p.destroyForcibly();
540539
throw new IOException("Process took too long to complete.");
541540
}
541+
p.exitValue();
542542
try (BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
543543
return reader.lines().collect(Collectors.toList());
544544
}

0 commit comments

Comments
 (0)