Skip to content

Commit 91d7ef4

Browse files
committed
8287401: jpackage tests failing on Windows due to powershell issue
Backport-of: c254c9d095d0473282ad74e66239a790912a3d76
1 parent 5d06ac0 commit 91d7ef4

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/jdk/tools/jpackage/helpers/jdk/jpackage/test/LauncherIconVerifier.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.lang.reflect.Method;
2929
import java.nio.file.Files;
3030
import java.nio.file.Path;
31-
import java.util.List;
3231
import java.util.Optional;
3332

3433
public final class LauncherIconVerifier {
@@ -136,18 +135,16 @@ private WinIconVerifier() {
136135

137136
private Path extractIconFromExecutable(Path outputDir, Path executable,
138137
String label) {
139-
Path psScript = outputDir.resolve(label + ".ps1");
140138
Path extractedIcon = outputDir.resolve(label + ".bmp");
141-
TKit.createTextFile(psScript, List.of(
139+
String script = String.join(";",
142140
"[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing')",
143141
String.format(
144-
"[System.Drawing.Icon]::ExtractAssociatedIcon(\"%s\").ToBitmap().Save(\"%s\", [System.Drawing.Imaging.ImageFormat]::Bmp)",
142+
"[System.Drawing.Icon]::ExtractAssociatedIcon('%s').ToBitmap().Save('%s', [System.Drawing.Imaging.ImageFormat]::Bmp)",
145143
executable.toAbsolutePath().normalize(),
146-
extractedIcon.toAbsolutePath().normalize()),
147-
"exit 0"));
144+
extractedIcon.toAbsolutePath().normalize()));
148145

149-
Executor.of("powershell", "-NoLogo", "-NoProfile", "-File",
150-
psScript.toAbsolutePath().normalize().toString()).execute();
146+
Executor.of("powershell", "-NoLogo", "-NoProfile", "-Command",
147+
script).execute();
151148

152149
return extractedIcon;
153150
}

0 commit comments

Comments
 (0)