Skip to content

Commit

Permalink
Merge pull request orphan-oss#28 from iheinrich/27_execute_chmod_usin…
Browse files Browse the repository at this point in the history
…g_process_builder

Use ProcessBuilder to launch 'chmod'
  • Loading branch information
lukaszlenart committed Sep 3, 2015
2 parents 88948eb + 5a41ac9 commit 4fd440c
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public void execute() throws MojoExecutionException {
}

File workdir = setupBuildEnvironment();

Config c = new Config();

c.setHeaderType(headerType);
Expand Down Expand Up @@ -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) {
Expand All @@ -468,7 +467,7 @@ private void setPermissions(File workdir) {
*/
private List<String> relativizeAndCopy(File workdir, List<String> paths) throws MojoExecutionException {
if(paths == null) return null;

List<String> result = new ArrayList<>();
for(String path : paths) {
Path source = basedir.toPath().resolve(path);
Expand All @@ -492,7 +491,7 @@ private List<String> relativizeAndCopy(File workdir, List<String> paths) throws

return result;
}

/**
* Downloads the platform-specific parts, if necessary.
*/
Expand Down

0 comments on commit 4fd440c

Please sign in to comment.