Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

Commit fb0a95f

Browse files
author
Alexander Matveev
committed
8269036: tools/jpackage/share/AppImagePackageTest.java failed with "hdiutil: create failed - Resource busy"
Reviewed-by: asemenyuk, herrick
1 parent 5ebed06 commit fb0a95f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ private Path buildDMG( Map<String, ? super Object> params,
346346
"-volname", APP_NAME.fetchFrom(params),
347347
"-ov", protoDMG.toAbsolutePath().toString(),
348348
"-fs", "HFS+");
349-
IOUtils.exec(pb, false, null, true, Executor.INFINITE_TIMEOUT);
349+
new RetryExecutor()
350+
.setMaxAttemptsCount(10)
351+
.setAttemptTimeoutMillis(3000)
352+
.setWriteOutputToFile(true)
353+
.execute(pb);
350354
}
351355

352356
// mount temp image

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public final class RetryExecutor {
3232
public RetryExecutor() {
3333
setMaxAttemptsCount(5);
3434
setAttemptTimeoutMillis(2 * 1000);
35+
setWriteOutputToFile(false);
3536
}
3637

3738
public RetryExecutor setMaxAttemptsCount(int v) {
@@ -44,6 +45,11 @@ public RetryExecutor setAttemptTimeoutMillis(int v) {
4445
return this;
4546
}
4647

48+
RetryExecutor setWriteOutputToFile(boolean v) {
49+
writeOutputToFile = v;
50+
return this;
51+
}
52+
4753
public RetryExecutor setExecutorInitializer(Consumer<Executor> v) {
4854
executorInitializer = v;
4955
return this;
@@ -69,11 +75,13 @@ static RetryExecutor retryOnKnownErrorMessage(String v) {
6975
}
7076

7177
public void execute(String cmdline[]) throws IOException {
72-
executeLoop(() -> Executor.of(cmdline));
78+
executeLoop(() ->
79+
Executor.of(cmdline).setWriteOutputToFile(writeOutputToFile));
7380
}
7481

7582
public void execute(ProcessBuilder pb) throws IOException {
76-
executeLoop(() -> Executor.of(pb));
83+
executeLoop(() ->
84+
Executor.of(pb).setWriteOutputToFile(writeOutputToFile));
7785
}
7886

7987
private void executeLoop(Supplier<Executor> execSupplier) throws IOException {
@@ -109,4 +117,5 @@ private void executeLoop(Supplier<Executor> execSupplier) throws IOException {
109117
private boolean aborted;
110118
private int attempts;
111119
private int timeoutMillis;
120+
private boolean writeOutputToFile;
112121
}

0 commit comments

Comments
 (0)