Skip to content

Commit cd31511

Browse files
committed
Convert io.quarkus.deployment.pkg.steps.NativeImageBuildStep to new process API
1 parent 8524166 commit cd31511

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import io.quarkus.sbom.ApplicationComponent;
5959
import io.quarkus.sbom.ApplicationManifestConfig;
6060
import io.smallrye.common.os.OS;
61+
import io.smallrye.common.process.ProcessBuilder;
6162

6263
public class NativeImageBuildStep {
6364

@@ -571,7 +572,7 @@ private static String getNativeImageExecutableName() {
571572
private static String detectNoPIE() {
572573
String argument = testGCCArgument("-no-pie");
573574

574-
return argument.length() == 0 ? testGCCArgument("-nopie") : argument;
575+
return argument.isEmpty() ? testGCCArgument("-nopie") : argument;
575576
}
576577

577578
private static String detectPIE() {
@@ -580,17 +581,11 @@ private static String detectPIE() {
580581

581582
private static String testGCCArgument(String argument) {
582583
try {
583-
Process gcc = new ProcessBuilder("cc", "-v", "-E", argument, "-").start();
584-
gcc.getOutputStream().close();
585-
if (gcc.waitFor() == 0) {
586-
return argument;
587-
}
588-
589-
} catch (IOException | InterruptedException e) {
590-
// eat
584+
ProcessBuilder.exec("cc", "-v", "-E", argument, "-");
585+
return argument;
586+
} catch (Exception ignored) {
587+
return "";
591588
}
592-
593-
return "";
594589
}
595590

596591
private static class NativeImageInvokerInfo {

0 commit comments

Comments
 (0)