Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 369d052

Browse files
author
Alexander Matveev
committedJul 22, 2020
8245311: [macos] misc package tests failed due to "execution error: Finder got an error: AppleEvent timed out."
Reviewed-by: herrick, asemenyuk
1 parent 2af788b commit 369d052

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
 

‎src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,12 @@ private Path buildDMG( Map<String, ? super Object> params,
443443
"-force",
444444
hdiUtilVerbosityFlag,
445445
mountedRoot.toAbsolutePath().toString());
446-
IOUtils.exec(pb);
446+
// "hdiutil detach" might not work right away due to resource busy error, so
447+
// repeat detach several times.
448+
RetryExecutor retryExecutor = new RetryExecutor();
449+
// 10 times with 3 second delays.
450+
retryExecutor.setMaxAttemptsCount(10).setAttemptTimeoutMillis(3000)
451+
.execute(pb);
447452
}
448453

449454
// Compress it to a new image

‎src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/RetryExecutor.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.io.IOException;
2828
import java.util.function.Consumer;
29+
import java.util.function.Supplier;
2930

3031
public final class RetryExecutor {
3132
RetryExecutor() {
@@ -64,10 +65,18 @@ static RetryExecutor retryOnKnownErrorMessage(String v) {
6465
}
6566

6667
void execute(String cmdline[]) throws IOException {
68+
executeLoop(() -> Executor.of(cmdline));
69+
}
70+
71+
void execute(ProcessBuilder pb) throws IOException {
72+
executeLoop(() -> Executor.of(pb));
73+
}
74+
75+
private void executeLoop(Supplier<Executor> execSupplier) throws IOException {
6776
aborted = false;
6877
for (;;) {
6978
try {
70-
Executor exec = Executor.of(cmdline);
79+
Executor exec = execSupplier.get();
7180
if (executorInitializer != null) {
7281
executorInitializer.accept(exec);
7382
}

0 commit comments

Comments
 (0)
This repository has been archived.