public List<String> getArguments() { List<String> arguments = new ArrayList<String>(); StringTokenizer tokenizer = new StringTokenizer(process.getCommandLine()); // Skip the exec name tokenizer.nextToken(); while (tokenizer.hasMoreTokens()){ arguments.add(tokenizer.nextToken()); } return arguments; } }
public synchronized EnvVars getEnvironmentVariables() { EnvVars envVars = new EnvVars(); for (String key : process.getEnvironmentVariables().keySet()) { envVars.put(key, process.getEnvironmentVariables().get(key)); } return envVars; }
private DarwinProcess(NativeProcess process) { super(process.getPid()); this.process = process; }
public void killRecursively() { logger.debug("Killing recursively process started by build" + getPid()); p.killRecursively(); }
public OSProcess getParent() { return get(process.getPpid()); }
public void kill() throws InterruptedException { logger.debug("Killing process started by build" + getPid()); p.kill(); killByKiller(); }
try { for (final NativeProcess p : nativeUtils.getWindowsProcesses()) { int pid = p.getPid(); super.processes.put(pid,new OSProcess(pid) { private EnvVars env;
@Override public synchronized List<String> getArguments() { if(args==null) args = Arrays.asList(QuotedStringTokenizer.tokenize(p.getCommandLine())); return args; }
@Override public synchronized EnvVars getEnvironmentVariables() { if(env==null) env = new EnvVars(p.getEnvironmentVariables()); return env; } });
Darwin(NativeUtils nativeUtils) { this.nativeUtils = nativeUtils; try { for (final NativeProcess process : nativeUtils.getMacProcesses()) { try { super.processes.put(process.getPid(), new DarwinProcess(process)); } catch (NativeAccessException exc) { // We may have access permission, skip and get rest of the process logger.warn("Failed to fecth Native Mac Processes", exc.getLocalizedMessage()); } } } catch (NativeAccessException exc) { // Don't fail if the Native Mac access plugin is not installed. logger.warn( "Failed to fecth Native Mac Processes", exc.getLocalizedMessage()); } }