private void killTree(int pid) { final int[] children = getChildProcesses(pid); LOG.debug("PID: {}, child PIDs: {}", pid, children); if (children.length > 0) { for (int cpid : children) { killTree(cpid); // kill process tree recursively } } int r = C_LIBRARY.kill(pid, CLibrary.SIGKILL); // kill origin process LOG.debug("kill {}", pid); if (r != 0) { if (LOG.isDebugEnabled()) { LOG.debug("kill for {} returns {}, strerror '{}'", pid, r, C_LIBRARY.strerror(r)); } } }
@Override int system(String command) { return C_LIBRARY.system(command); } }