Skip to content

Commit

Permalink
Only try to set POSIX file attributes on a POSIX system.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdlaird committed Aug 13, 2021
1 parent b3bdc2c commit e706c7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clean:
$(GRADLE_BIN) clean

test:
$(GRADLE_BIN) test --debug
$(GRADLE_BIN) test

docs:
$(GRADLE_BIN) javadoc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,14 @@ private void installNgrokZip(Path zip, Path dest) {
in.closeEntry();
in.close();

final Path ngrok = Paths.get(dest.toString(), getNgrokBin());
final Set<PosixFilePermission> perms = Files.readAttributes(ngrok, PosixFileAttributes.class).permissions();
perms.add(PosixFilePermission.OWNER_EXECUTE);
perms.add(PosixFilePermission.GROUP_EXECUTE);
perms.add(PosixFilePermission.OTHERS_EXECUTE);
Files.setPosixFilePermissions(ngrok, perms);
if (dest.getFileSystem().supportedFileAttributeViews().contains("posix")) {
final Path ngrok = Paths.get(dest.toString(), getNgrokBin());
final Set<PosixFilePermission> perms = Files.readAttributes(ngrok, PosixFileAttributes.class).permissions();
perms.add(PosixFilePermission.OWNER_EXECUTE);
perms.add(PosixFilePermission.GROUP_EXECUTE);
perms.add(PosixFilePermission.OTHERS_EXECUTE);
Files.setPosixFilePermissions(ngrok, perms);
}
} catch (IOException e) {
throw new NgrokException("An error occurred while unzipping ngrok.", e);
}
Expand Down

0 comments on commit e706c7b

Please sign in to comment.