From 5a41ac9c6f8cc06c1fab0975731bd6340cb82147 Mon Sep 17 00:00:00 2001 From: Ingo Heinrich Date: Wed, 2 Sep 2015 17:27:54 +0200 Subject: [PATCH] Use ProcessBuilder to launch 'chmod' --- .../akathist/maven/plugins/launch4j/Launch4jMojo.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java b/src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java index 170e938..12d3990 100644 --- a/src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java +++ b/src/main/java/com/akathist/maven/plugins/launch4j/Launch4jMojo.java @@ -289,7 +289,7 @@ public void execute() throws MojoExecutionException { } File workdir = setupBuildEnvironment(); - + Config c = new Config(); c.setHeaderType(headerType); @@ -451,10 +451,9 @@ private File unpackWorkDir(Artifact a) throws MojoExecutionException { */ private void setPermissions(File workdir) { if (!System.getProperty("os.name").startsWith("Windows")) { - Runtime r = Runtime.getRuntime(); try { - r.exec("chmod 755 " + workdir + "/bin/ld").waitFor(); - r.exec("chmod 755 " + workdir + "/bin/windres").waitFor(); + new ProcessBuilder("chmod", "755", workdir + "/bin/ld").start().waitFor(); + new ProcessBuilder("chmod", "755", workdir + "/bin/windres").start().waitFor(); } catch (InterruptedException e) { getLog().warn("Interrupted while chmodding platform-specific binaries", e); } catch (IOException e) { @@ -468,7 +467,7 @@ private void setPermissions(File workdir) { */ private List relativizeAndCopy(File workdir, List paths) throws MojoExecutionException { if(paths == null) return null; - + List result = new ArrayList<>(); for(String path : paths) { Path source = basedir.toPath().resolve(path); @@ -492,7 +491,7 @@ private List relativizeAndCopy(File workdir, List paths) throws return result; } - + /** * Downloads the platform-specific parts, if necessary. */