public void testForce() { ProcessUtil kp = new ProcessUtil("4321", null, null); String[] args = kp.killArgs(true); assertEquals("-9", args[1]); }
public void inner() { new ProcessUtil(pid(), err, err).forceKill(); } };
private boolean processRunning() { if (!pidFile.exists()) { return false; } return new ProcessUtil(pid(), out, err, baseDir, utils, windowsKillCommand).isRunning(); }
/** * @param force */ private void kill(boolean force) { String threadName = "killing process " + pid; if (force) { threadName = "force " + threadName; } launchShell(threadName, killArgs(force), 10); }
public void testPidWithEOL() { String pid = " 3343\n"; ProcessUtil kp = new ProcessUtil(pid, devNull, devNull, dir); assertEquals("3343", kp.pid()); }
public boolean isRunning() { String threadName = "is_process_" + pid + "_running"; Shell shell = launchShell(threadName, isRunningArgs(), 5); if (!shell.hasReturned()) { return false; } return shell.returnCode() == 0; }
public void testFileCreation() { ProcessUtil pu = new ProcessUtil("1234", null, null); File winKill; winKill = pu.getWindowsKillFile(); assertTrue(winKill.exists()); winKill.delete(); assertFalse(winKill.exists()); winKill = pu.getWindowsKillFile(); assertTrue(winKill.exists()); } }
public void testIsRunning() { String pid = "5234"; ProcessUtil kp = new ProcessUtil(pid, devNull, devNull, dir); String[] args = kp.isRunningArgs(); testUtil.assertContainsIgnoreCase(args[0], "kill"); assertEquals("-0", args[1]); assertEquals(pid, args[2]); }
public void inner() { new ProcessUtil(pid(), err, err).kill(); } };
@Override public void inner() { kill(); } };
private void issueNormalKill() { if (!pidFile.exists()) { printWarning("Not running? File not found: " + pidFile); return; } new ProcessUtil(pid(), err, err, baseDir, utils, windowsKillCommand) .killNoThrow(); waitForProcessToDie(); }
ProcessUtil(FileUtil fileUtil, String pid, PrintStream out, PrintStream err, Str str, Shell.Factory shellFactory, Streams streams, Threads threads) { this.pid = (pid != null) ? pid.trim() : "-1"; this.out = out; this.err = err; this.fileUtil = fileUtil; this.str = str; this.shellFactory = shellFactory; this.streams = streams; this.threads = threads; if (fileUtil.isWindows()) { this.killCommand = getWindowsKillFile().getPath(); } else { this.killCommand = "kill"; } }
private void issueNormalKill() { if (!pidFile().exists()) { printWarning("Not running? File not found: " + pidFile()); return; } Exceptions.VoidBlock block = new Exceptions.VoidBlock() { public void inner() { new ProcessUtil(pid(), err, err).kill(); } }; block.execSwallowingException(err); waitForProcessToDie(); }
/** * @param force */ private void kill(boolean force) { String threadName = "killing process " + pid; if (force) { threadName = "force " + threadName; } launchShell(threadName, killArgs(force), 10); }
public boolean isRunning() { String threadName = "is_process_" + pid + "_running"; Shell shell = launchShell(threadName, isRunningArgs(), 5); if (!shell.hasReturned()) { return false; } return shell.returnCode() == 0; }
public void testPidWithEOL() { String pid = " 3343\n"; ProcessUtil kp = new ProcessUtil(pid, null, null); assertEquals("3343", kp.pid()); }
public void testFileCreation() { ProcessUtil pu = new ProcessUtil("1234", devNull, devNull, dir); File winKill; winKill = pu.getWindowsKillFile(wk); assertTrue(winKill.exists()); winKill.delete(); assertFalse(winKill.exists()); winKill = pu.getWindowsKillFile(wk); assertTrue(winKill.exists()); } }
public void testIsRunning() { String pid = "5234"; ProcessUtil kp = new ProcessUtil(pid, null, null); String[] args = kp.isRunningArgs(); new TestUtil().assertContainsIgnoreCase(args[0], "kill"); assertEquals("-0", args[1]); assertEquals(pid, args[2]); }
public void inner() { kill(); } };
private void issueNormalKill() { if (!pidFile.exists()) { printWarning("Not running? File not found: " + pidFile); return; } new ProcessUtil(pid(), err, err, baseDir, utils).killNoThrow(); waitForProcessToDie(); }