private static void grantPermissions(final File f) { FileUtil.setExecutable(f, true); FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); }
private static void grantPermissions(final File f) { FileUtil.setExecutable(f, true); FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); }
private static void grantPermissions(final File f) { FileUtil.setExecutable(f, true); FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); }
private static void grantPermissions(final File f) { FileUtil.setExecutable(f, true); FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); }
private static void grantPermissions(final File f) { FileUtil.setExecutable(f, true); FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); }
private static void revokePermissions(final File f) { FileUtil.setWritable(f, false); FileUtil.setExecutable(f, false); FileUtil.setReadable(f, false); }
private static void grantPermissions(final File f) { FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); FileUtil.setExecutable(f, true); }
private static void grantPermissions(final File f) { FileUtil.setReadable(f, true); FileUtil.setWritable(f, true); FileUtil.setExecutable(f, true); }
private static void revokePermissions(final File f) { FileUtil.setWritable(f, false); FileUtil.setExecutable(f, false); FileUtil.setReadable(f, false); }
public void testShellCommandTimeout() throws Throwable { if(Shell.WINDOWS) { // setExecutable does not work on Windows return; } String rootDir = new File(System.getProperty( "test.build.data", "/tmp")).getAbsolutePath(); File shellFile = new File(rootDir, "timeout.sh"); String timeoutCommand = "sleep 4; echo \"hello\""; PrintWriter writer = new PrintWriter(new FileOutputStream(shellFile)); writer.println(timeoutCommand); writer.close(); FileUtil.setExecutable(shellFile, true); Shell.ShellCommandExecutor shexc = new Shell.ShellCommandExecutor(new String[]{shellFile.getAbsolutePath()}, null, null, 100); try { shexc.execute(); } catch (Exception e) { //When timing out exception is thrown. } shellFile.delete(); assertTrue("Script didnt not timeout" , shexc.isTimedOut()); }
public void testShellCommandTimeout() throws Throwable { if(Shell.WINDOWS) { // setExecutable does not work on Windows return; } String rootDir = new File(System.getProperty( "test.build.data", "/tmp")).getAbsolutePath(); File shellFile = new File(rootDir, "timeout.sh"); String timeoutCommand = "sleep 4; echo \"hello\""; PrintWriter writer = new PrintWriter(new FileOutputStream(shellFile)); writer.println(timeoutCommand); writer.close(); FileUtil.setExecutable(shellFile, true); Shell.ShellCommandExecutor shexc = new Shell.ShellCommandExecutor(new String[]{shellFile.getAbsolutePath()}, null, null, 100); try { shexc.execute(); } catch (Exception e) { //When timing out exception is thrown. } shellFile.delete(); assertTrue("Script didnt not timeout" , shexc.isTimedOut()); }
FileUtil.setExecutable(testFile, false); assertFalse(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE)); FileUtil.setExecutable(testFile, true); assertTrue(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE)); FileUtil.setExecutable(testFile, false); assertFalse(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE)); FileUtil.setExecutable(testFile, true); assertTrue(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE));
FileUtil.setExecutable(testFile, false); assertFalse(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE)); FileUtil.setExecutable(testFile, true); assertTrue(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE)); FileUtil.setExecutable(testFile, false); assertFalse(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE)); FileUtil.setExecutable(testFile, true); assertTrue(NativeIO.Windows.access(testFile.getAbsolutePath(), NativeIO.Windows.AccessRight.ACCESS_EXECUTE));
FileUtil.setExecutable(currentDir, false); FileUtil.setExecutable(currentDir, true); nn.restoreFailedStorage("true"); nn.rollEditLog(); } finally { if (currentDir != null) { FileUtil.setExecutable(currentDir, true);