run abstract method

Future<ProcessResult> run(
  1. List<Object> command,
  2. {String? workingDirectory,
  3. Map<String, String>? environment,
  4. bool includeParentEnvironment = true,
  5. bool runInShell = false,
  6. Encoding? stdoutEncoding = systemEncoding,
  7. Encoding? stderrEncoding = systemEncoding}

Starts a process and runs it non-interactively to completion.

The first element in command will be treated as the executable to run, with subsequent elements being passed as arguments to the executable. It is left to implementations to decide what element types they support in the command list.

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.

If includeParentEnvironment is true, the process's environment will include the parent process's environment, with environment taking precedence. Default is true.

If runInShell is true, the process will be spawned through a system shell. On Linux and OS X, /bin/sh is used, while %WINDIR%\system32\cmd.exe is used on Windows.

The encoding used for decoding stdout and stderr into text is controlled through stdoutEncoding and stderrEncoding. The default encoding is systemEncoding. If null is used no decoding will happen and the ProcessResult will hold binary data.

Returns a Future<ProcessResult> that completes with the result of running the process, i.e., exit code, standard out and standard in.

The following code uses run to grep for main in the file test.dart on Linux.

ProcessManager mgr = new LocalProcessManager();'grep', ['-i', 'main', 'test.dart']).then((result) {


Future<ProcessResult> run(
  List<Object> command, {
  String? workingDirectory,
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
  bool runInShell = false,
  Encoding? stdoutEncoding = systemEncoding,
  Encoding? stderrEncoding = systemEncoding,