Create a new {@link ProcessBuilder} that will run with the Java executable.
@param arguments the command arguments
@return a {@link ProcessBuilder}
485153
public ProcessBuilder processBuilder(String... arguments) {
		ProcessBuilder processBuilder = new ProcessBuilder(toString());
		processBuilder.command().addAll(Arrays.asList(arguments));
		return processBuilder;
	}
20407
function execWithSpawn (argv, cwd, cb) {
  cwd = cwd || process.cwd()
  var opts = [
    '-Dplantuml.include.path=' + cwd,
    '-Djava.awt.headless=true',
    '-jar', PLANTUML_JAR
  ].concat(argv)
  return childProcess.spawn('java', opts)
}
861335
protected function execute(array $arguments)
    {
        \array_unshift($arguments, $this->path);
        
        $builder = ProcessBuilder::create($arguments);
        $process = $builder->getProcess();
        $process->run();
        
        if (!$process->isSuccessful()) {
            throw CommandException::factory($process);
        }
        
        // E.g. tesseract --version returns output as error output
        return $process->getOutput() ? $process->getOutput() : $process->getErrorOutput();
    }
1345362
public <K, V> void build(CommandArgs<K, V> args) {

        // ADDJOB queue_name job <ms-timeout> [REPLICATE <count>] [DELAY <sec>] [RETRY <sec>] [TTL <sec>] [MAXLEN <count>]
        // [ASYNC]

        if (replicate != null) {
            args.add(REPLICATE).add(replicate);
        }

        if (delay != null) {
            args.add(CommandKeyword.DELAY).add(delay);
        }

        if (retry != null) {
            args.add(CommandKeyword.RETRY).add(retry);
        }

        if (ttl != null) {
            args.add(CommandKeyword.TTL).add(ttl);
        }

        if (maxlen != null) {
            args.add(CommandKeyword.MAXLEN).add(maxlen);
        }

        if (async != null && async.booleanValue()) {
            args.add(CommandKeyword.ASYNC);
        }
    }
1073851
public void build(final String... args) {
        if (args != null) {
            final CmdLineParser parser = new CmdLineParser(this, ParserProperties.defaults().withUsageWidth(80));

            try {
                parser.parseArgument(args);
            } catch (final CmdLineException e) {
                throw new ClusterRunnerException("Failed to parse args: " + Strings.arrayToDelimitedString(args, " "));
            }
        }

        if (basePath == null) {
            try {
                basePath = Files.createTempDirectory("es-cluster").toAbsolutePath().toString();
            } catch (final IOException e) {
                throw new ClusterRunnerException("Could not create $ES_HOME.", e);
            }
        }

        final Path esBasePath = Paths.get(basePath);
        createDir(esBasePath);

        final String[] types = moduleTypes == null ? MODULE_TYPES : moduleTypes.split(",");
        for (final String moduleType : types) {
            Class<? extends Plugin> clazz;
            try {
                clazz = Class.forName(moduleType).asSubclass(Plugin.class);
                pluginList.add(clazz);
            } catch (final ClassNotFoundException e) {
                logger.debug(moduleType + " is not found.", e);
            }
        }
        if (pluginTypes != null) {
            for (final String value : pluginTypes.split(",")) {
                final String pluginType = value.trim();
                if (pluginType.length() > 0) {
                    Class<? extends Plugin> clazz;
                    try {
                        clazz = Class.forName(pluginType).asSubclass(Plugin.class);
                        pluginList.add(clazz);
                    } catch (final ClassNotFoundException e) {
                        throw new ClusterRunnerException(pluginType + " is not found.", e);
                    }
                }
            }
        }

        print("Cluster Name: " + clusterName);
        print("Base Path:    " + basePath);
        print("Num Of Node:  " + numOfNode);

        for (int i = 0; i < numOfNode; i++) {
            execute(i + 1);
        }
    }
976848
public function arg(string $arg): ProcessBuilder
    {
        if ($arg === '') {
            return $this;
        }

        $this->arguments[] = $arg;

        return $this;
    }
1175349
public int runCompiler(String... args) {
		try {
			final BQRuntime runtime = createRuntime(args);
			final CommandOutcome outcome = runtime.run();
			if (!outcome.isSuccess() && outcome.getException() != null) {
				Logger.getRootLogger().error(outcome.getMessage(), outcome.getException());
			}
			return outcome.getExitCode();
		} catch (ProvisionException exception) {
			final Throwable ex = Throwables.getRootCause(exception);
			if (ex != null) {
				Logger.getRootLogger().error(ex.getLocalizedMessage());
			} else {
				Logger.getRootLogger().error(exception.getLocalizedMessage());
			}
		} catch (Throwable exception) {
			Logger.getRootLogger().error(exception.getLocalizedMessage());
		}
		return Constants.ERROR_CODE;
	}
611246
public ProcessBuilder getProcessBuilder()
	{
		if (spawned)
			return builder; // throw new IllegalStateException("Cannot call spawn twice!");

		if (runAs != null)
		{
			String command = cmd.get(0);

			if (command.charAt(0) == '-' && !SudoFeature.hasArgumentsEnd())
				throw new IllegalArgumentException("Command to runAs starts with - but this version of sudo does not support the -- argument end token: this command cannot, therefore, be executed securely. Command was: '" +
				                                   command + "'");

			// Pass the environment in through an "env" command:
			if (this.environment.size() > 0)
			{
				for (final String key : this.environment.keySet())
				{
					final String value = this.environment.get(key);

					final String var = key + "=" + value;

					addToCmd(0, var);
				}

				// cmd.add(0,"env");
				addToCmd(0, "env");
			}

			// cmd.add(0, "--"); // doesn't work everywhere
			// cmd.add(0, runAs);
			// cmd.add(0, "-u");
			// cmd.add(0, "-n"); // Never prompt for a password: we simply cannot provide one
			// cmd.add(0, "sudo");

			if (SudoFeature.hasArgumentsEnd())
				addToCmd(0, "--");

			// If possible tell sudo to run non-interactively
			String noninteractive = SudoFeature.hasNonInteractive() ? "-n" : null;

			if (this.runAs.equals(SUPERUSER_IDENTIFIER))
			{
				addToCmd(0, "sudo", noninteractive);
			}
			else
				addToCmd(0, "sudo", noninteractive, "-u", runAs);
		}
		else
		{
			builder.environment().putAll(this.environment);
		}

		spawned = true;

		if (log.isInfoEnabled())
		{
			log.info("ProcessBuilder created for command: " + join(" ", cmd));
		}

		return builder;
	}
234712
@SafeVarargs
  public final QueryBuilder arguments(Object...args) {
    set(Param.QUERY_ARGS, "");
    queryArgs = args.clone();
    return this;
  }
1350570
private ProcessBuilder appendExecutablePath(ProcessBuilder builder) {
    String executable = builder.command().get(0);
    if (executable == null) {
      throw new IllegalArgumentException(
          "No executable provided to the Process Builder... we will do... nothing... ");
    }
    builder.command().set(0,
        FileUtils.getFileResourceId(configuration.getWorkerPath(), executable).toString());
    return builder;
  }
1273280
public ProcessExecutor command(String... command) {
    builder.command(fixArguments(Arrays.asList(command)));
    return this;
  }
897075
public static void main(String[] args) throws Exception {
		CeUserArgumentProcessor processor = new CeUserArgumentProcessor(); //Responsible for creating a CeMain instance
		processor.process(args);
	}
1281100
public Process launch() throws IOException {
        final ProcessBuilder processBuilder = new ProcessBuilder(builder.build());
        if (outputDestination != null) {
            processBuilder.redirectOutput(outputDestination);
        }
        if (errorDestination != null) {
            processBuilder.redirectError(errorDestination);
        }
        if (workingDirectory != null) {
            processBuilder.directory(workingDirectory);
        }
        if (!env.isEmpty()) {
            processBuilder.environment().putAll(env);
        }
        processBuilder.redirectErrorStream(redirectErrorStream);
        return processBuilder.start();
    }
183137
private void processCommand(List<String> command) throws Exception {
        processBuilder.command(command);
        Process p = processBuilder.start();
        checkReturnCode(p, processBuilder.command().toString(), ReturnCode.OK.getValue(), ReturnCode.ALREADY_EXISTS.getValue());
        if (!acceptLicense) {
            throw new BuildException("To install a feature, you must accept the feature's license terms and conditions.");
        }
    }
1041321
@Override
    public Object executeWithArgs(ExecutionType executionType, Object[] args) throws CommandActionExecutionException {
        if(ExecutionType.ASYNCHRONOUS == executionType){
            Closure closure = AsyncClosureFactory.getInstance().createClosure(metaHolder, method, object, args);
            return executeClj(closure.getClosureObj(), closure.getClosureMethod());
        }

        return execute(object, method, args);
    }
379530
public Execed start() throws IOException
	{
		Process p = getProcessBuilder().start();

		return new Execed(cmd, p, builder.redirectErrorStream());
	}
948962
public static ProcessBuilder getProcessBuilder(String mainClass, List<URL> classPath, List<String> args) throws LauncherException
	{
		List<String> cmdList = new ArrayList<String>();
		String[] cmdArray;
		
		cmdList.add(getJavaPath());
		if(classPath != null && classPath.size() > 0)
		{
			cmdList.add("-cp");
			cmdList.add(mkPath(classPath));
		}
		cmdList.add(mainClass);
		if(args!=null && args.size()>0)
			cmdList.addAll(args);
		cmdArray = cmdList.toArray(new String[cmdList.size()]);
		if(logger.isDebugEnabled())
			logger.debug("cmdArray=" + Arrays.toString(cmdArray));
		return new ProcessBuilder(cmdArray);
	}