public static int processLauncherAndWait(Map<String, Object> conf, String user, List<String> args, final Map<String, String> environment, final String logPreFix) throws IOException { int ret = 0; Process process = processLauncher(conf, user, null, args, environment, logPreFix, null, null); if (StringUtils.isNotBlank(logPreFix)) Utils.readAndLogStream(logPreFix, process.getInputStream()); try { process.waitFor(); } catch (InterruptedException e) { LOG.info("{} interrupted.", logPreFix); } ret = process.exitValue(); return ret; }
@Override protected void launchWorkerProcess(List<String> command, Map<String, String> env, String logPrefix, ExitCodeCallback processExitCallback, File targetDir) throws IOException { String workerDir = targetDir.getAbsolutePath(); String user = this.getWorkerUser(); List<String> args = Arrays.asList("worker", workerDir, Utils.writeScript(workerDir, command, env)); List<String> commandPrefix = null; SupervisorUtils.processLauncher(_conf, user, commandPrefix, args, null, logPrefix, processExitCallback, targetDir); } }