@Override public void run() { try { if (stdout) { ProcessUtils.readProcessError(process); } else { ProcessUtils.readProcessOutput(process); } } catch (Throwable ex) { } } });
public Boolean call() throws Exception { NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(execEnv); npb.setExecutable(collectCMD).setArguments("-n", "-r races", executable); // NOI18N Process p = npb.call(); List<String> out = ProcessUtils.readProcessOutput(p); int result = p.waitFor(); if (result == 0) { String identifier = loc("THA_InstrumentedIdentifier"); // NOI18N for (String s : out) { if (s.contains(identifier)) { return true; } } } return false; } });
try { processError = ProcessUtils.readProcessError(engineProc); processOutput = ProcessUtils.readProcessOutput(engineProc); } catch (IOException ex) { Exceptions.printStackTrace(ex);
public CollectVersion call() throws Exception { NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(execEnv); npb.setExecutable(binDir + "version").setArguments(collectCMD); // NOI18N NativeProcess np = npb.call(); List<String> output = ProcessUtils.readProcessOutput(np); int result = np.waitFor(); if (result == 0) { return CollectVersion.getCollectVersion(output.get(0)); } return CollectVersion.UNKNOWN; } });
@Override public PsData getData(boolean allProcesses) { PsData res = super.getData(allProcesses); // pargs call if needed if (res != null && !DISABLE_PARGS && !res.processes.isEmpty()) { NativeProcessBuilder pargsBuilder = NativeProcessBuilder.newProcessBuilder(exEnv); pargsBuilder.setExecutable("/usr/bin/pargs").redirectError(); // NOI18N pargsBuilder.getEnvironment().put("LC_ALL", "C"); // NOI18N String[] pargs_args = new String[res.processes.size()+1]; pargs_args[0] = "-Fl"; // NOI18N int idx = 1; for (Vector<String> proc : res.processes) { pargs_args[idx++] = proc.get(pidColumnIndex()); } pargsBuilder.setArguments(pargs_args); try { List<String> pargsOutput = ProcessUtils.readProcessOutput(pargsBuilder.call()); updatePargsData(res, pargs_args, pargsOutput); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } return res; } }
private void run() { if (tool.getExecutionEnvironment().isLocal()) { // we're dealing with a local toolchain path = LinkSupport.resolveWindowsLink(path); File file = new File(path); if (!file.exists()) { alreadyRun = true; return; } } NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(tool.getExecutionEnvironment()); npb.setExecutable(path); npb.setArguments(getVersionFlags()); npb.redirectError(); try { NativeProcess p = npb.call(); p.getOutputStream().close(); final List<String> processOutput = ProcessUtils.readProcessOutput(p); if (processOutput != null && processOutput.size() > 0) { version = processOutput.get(0); } } catch (Exception ex) { // silently drop } alreadyRun = true; }
private void run() { if (tool.getExecutionEnvironment().isLocal()) { // we're dealing with a local toolchain path = LinkSupport.resolveWindowsLink(path); File file = new File(path); if (!file.exists()) { alreadyRun = true; return; } } NativeProcessBuilder npb = NativeProcessBuilder.newProcessBuilder(tool.getExecutionEnvironment()); npb.setExecutable(path); npb.setArguments(getVersionFlags()); npb.redirectError(); try { NativeProcess p = npb.call(); p.getOutputStream().close(); final List<String> processOutput = ProcessUtils.readProcessOutput(p); if (processOutput != null && processOutput.size() > 0) { version = processOutput.get(0); } } catch (Exception ex) { // silently drop } alreadyRun = true; }
for (String line : ProcessUtils.readProcessOutput(process)) { if (Log.Ps.debug) System.out.printf("PsOutput: '%s'\n", line); // NOI18N