Skip to content

Commit 4fd440c

Browse files
committed
Merge pull request #28 from iheinrich/27_execute_chmod_using_process_builder
Use ProcessBuilder to launch 'chmod'
2 parents 88948eb + 5a41ac9 commit 4fd440c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ public void execute() throws MojoExecutionException {
289289
}
290290

291291
File workdir = setupBuildEnvironment();
292-
292+
293293
Config c = new Config();
294294

295295
c.setHeaderType(headerType);
@@ -451,10 +451,9 @@ private File unpackWorkDir(Artifact a) throws MojoExecutionException {
451451
*/
452452
private void setPermissions(File workdir) {
453453
if (!System.getProperty("os.name").startsWith("Windows")) {
454-
Runtime r = Runtime.getRuntime();
455454
try {
456-
r.exec("chmod 755 " + workdir + "/bin/ld").waitFor();
457-
r.exec("chmod 755 " + workdir + "/bin/windres").waitFor();
455+
new ProcessBuilder("chmod", "755", workdir + "/bin/ld").start().waitFor();
456+
new ProcessBuilder("chmod", "755", workdir + "/bin/windres").start().waitFor();
458457
} catch (InterruptedException e) {
459458
getLog().warn("Interrupted while chmodding platform-specific binaries", e);
460459
} catch (IOException e) {
@@ -468,7 +467,7 @@ private void setPermissions(File workdir) {
468467
*/
469468
private List<String> relativizeAndCopy(File workdir, List<String> paths) throws MojoExecutionException {
470469
if(paths == null) return null;
471-
470+
472471
List<String> result = new ArrayList<>();
473472
for(String path : paths) {
474473
Path source = basedir.toPath().resolve(path);
@@ -492,7 +491,7 @@ private List<String> relativizeAndCopy(File workdir, List<String> paths) throws
492491

493492
return result;
494493
}
495-
494+
496495
/**
497496
* Downloads the platform-specific parts, if necessary.
498497
*/

0 commit comments

Comments
 (0)