execInParallel function

Future<ProcessResult> execInParallel(
  1. String executable,
  2. List<String> arguments,
  3. {String? workingDirectory,
  4. Map<String, String>? environment}
)

Runs a command in a shell, without waiting for other processes to complete. Returns a ProcessResult once the process has terminated.

Processes run by this command are executed immediately. Nothing will be printed on the console, but the outputs will still be available in ProcessResult.

Use workingDirectory to set the working directory for the process. Note that the change of directory occurs before executing the process on some platforms, which may have impact when using relative paths for the executable and the arguments.

Use environment to set the environment variables for the process. If not set the environment of the parent process is inherited. Currently, only US-ASCII environment variables are supported and errors are likely to occur if an environment variable with code-points outside the US-ASCII range is passed in.

Implementation

Future<ProcessResult> execInParallel(
  String executable,
  List<String> arguments, {
  String? workingDirectory,
  Map<String, String>? environment,
}) async {
  return _exec(
    executable,
    arguments.unmodifiableCopy(),
    workingDirectory,
    true,
    environment?.unmodifiableCopy(),
  );
}