Skip to content

Commit

Permalink
Fix file permissions on the executable
Browse files Browse the repository at this point in the history
  • Loading branch information
avojak committed Apr 9, 2019
1 parent 0e38097 commit 2d170af
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.attribute.AclFileAttributeView;
import java.util.Arrays;
import java.util.Optional;

Expand Down Expand Up @@ -149,6 +151,7 @@ public void launch(final ILaunchConfiguration configuration, final String mode,
}
}

setExecutablePermissions(executable);
validateExecutable(executable);

// TODO: Should the executable be copied to a temp location instead of running
Expand Down Expand Up @@ -241,6 +244,18 @@ private void validateExecutablePreference(final String executablePreference) thr
}
}

/**
* Attempts to set the permissions on the executable such that it can be read
* and executed.
*
* @param executable
* The {@link File} to execute.
*/
private void setExecutablePermissions(final File executable) {
executable.setReadable(true);
executable.setExecutable(true);
}

/**
* Validate that the given {@link File} exists, is a file, and able to be
* executed.
Expand Down

0 comments on commit 2d170af

Please sign in to comment.