Skip to content

Commit

Permalink
Fix exceptions were swallowed on cleanup.
Browse files Browse the repository at this point in the history
chumer committed Jan 27, 2020
1 parent a2e5d9c commit ecb20a7
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -443,22 +443,15 @@ public void run(Map<Method, CEntryPointData> entryPoints,
ImageSingletons.add(RuntimeOptionValues.class, new RuntimeOptionValues(optionProvider.getRuntimeValues(), allOptionNames));

doRun(entryPoints, javaMainSupport, imageName, k, harnessSubstitutions, compilationExecutor, analysisExecutor);
} finally {
} catch (Throwable t) {
try {
/*
* Make sure we clean up after ourselves even in the case of an exception.
*/
if (deleteTempDirectory) {
deleteAll(tempDirectory());
}
featureHandler.forEachFeature(Feature::cleanup);
} catch (Throwable e) {
/*
* Suppress subsequent errors so that we unwind the original error brought
* us here.
*/
cleanup();
} catch (Throwable ecleanup) {
t.addSuppressed(ecleanup);
}
throw t;
}
cleanup();
}).get();
} catch (InterruptedException | CancellationException e) {
System.out.println("Interrupted!");
@@ -474,6 +467,13 @@ public void run(Map<Method, CEntryPointData> entryPoints,
}
}

private void cleanup() {
if (deleteTempDirectory) {
deleteAll(tempDirectory());
}
featureHandler.forEachFeature(Feature::cleanup);
}

protected static void setSystemPropertiesForImageEarly() {
System.setProperty(ImageInfo.PROPERTY_IMAGE_CODE_KEY, ImageInfo.PROPERTY_IMAGE_CODE_VALUE_BUILDTIME);
}

0 comments on commit ecb20a7

Please sign in to comment.