8245311: [macos] misc package tests failed due to "execution error: Finder got an error: AppleEvent timed out."
Reviewed-by: herrick, asemenyuk
This commit is contained in:
parent
a764279daa
commit
f8a06bc497
@ -443,7 +443,12 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
|
||||
"-force",
|
||||
hdiUtilVerbosityFlag,
|
||||
mountedRoot.toAbsolutePath().toString());
|
||||
IOUtils.exec(pb);
|
||||
// "hdiutil detach" might not work right away due to resource busy error, so
|
||||
// repeat detach several times.
|
||||
RetryExecutor retryExecutor = new RetryExecutor();
|
||||
// 10 times with 3 second delays.
|
||||
retryExecutor.setMaxAttemptsCount(10).setAttemptTimeoutMillis(3000)
|
||||
.execute(pb);
|
||||
}
|
||||
|
||||
// Compress it to a new image
|
||||
|
@ -26,6 +26,7 @@ package jdk.incubator.jpackage.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class RetryExecutor {
|
||||
RetryExecutor() {
|
||||
@ -64,10 +65,18 @@ public final class RetryExecutor {
|
||||
}
|
||||
|
||||
void execute(String cmdline[]) throws IOException {
|
||||
executeLoop(() -> Executor.of(cmdline));
|
||||
}
|
||||
|
||||
void execute(ProcessBuilder pb) throws IOException {
|
||||
executeLoop(() -> Executor.of(pb));
|
||||
}
|
||||
|
||||
private void executeLoop(Supplier<Executor> execSupplier) throws IOException {
|
||||
aborted = false;
|
||||
for (;;) {
|
||||
try {
|
||||
Executor exec = Executor.of(cmdline);
|
||||
Executor exec = execSupplier.get();
|
||||
if (executorInitializer != null) {
|
||||
executorInitializer.accept(exec);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user