Skip to content

Commit 605c581

Browse files
committed
Ensure file is executable on posix file systems
1 parent 2a2c279 commit 605c581

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

jbrowse/src/org/labkey/jbrowse/JBrowseManager.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@
5050

5151
import java.io.File;
5252
import java.io.IOException;
53+
import java.nio.file.FileSystems;
54+
import java.nio.file.Files;
55+
import java.nio.file.attribute.PosixFilePermission;
5356
import java.util.Arrays;
5457
import java.util.List;
5558
import java.util.Map;
59+
import java.util.Set;
5660

5761
public class JBrowseManager
5862
{
@@ -218,6 +222,23 @@ else if (SystemUtils.IS_OS_MAC_OSX)
218222
throw new PipelineJobException("Unknown OS: " + SystemUtils.OS_NAME);
219223
}
220224

225+
try
226+
{
227+
if (FileSystems.getFileSystem(exe.toURI()).supportedFileAttributeViews().contains("posix"))
228+
{
229+
Set<PosixFilePermission> perms = Files.getPosixFilePermissions(exe.toPath());
230+
if (!perms.contains(PosixFilePermission.OWNER_EXECUTE))
231+
{
232+
perms.add(PosixFilePermission.OWNER_EXECUTE);
233+
Files.setPosixFilePermissions(exe.toPath(), perms);
234+
}
235+
}
236+
}
237+
catch (IOException e)
238+
{
239+
throw new PipelineJobException(e);
240+
}
241+
221242
if (!exe.exists())
222243
{
223244
throw new PipelineJobException("Unable to find file: " + exe.getPath());

0 commit comments

Comments
 (0)