start static method

Future<TestProcess> start(
  1. String executable,
  2. Iterable<String> arguments, {
  3. String? workingDirectory,
  4. Map<String, String>? environment,
  5. bool includeParentEnvironment = true,
  6. bool runInShell = false,
  7. String? description,
  8. Encoding encoding = utf8,
  9. bool forwardStdio = false,
})

Starts a process.

executable, arguments, workingDirectory, and environment have the same meaning as for Process.start.

description is a string description of this process; it defaults to the command-line invocation. encoding is the Encoding that will be used for the process's input and output; it defaults to utf8.

If forwardStdio is true, the process's stdout and stderr will be printed to the console as they appear. This is only intended to be set temporarily to help when debugging test failures.

Implementation

static Future<TestProcess> start(
    String executable, Iterable<String> arguments,
    {String? workingDirectory,
    Map<String, String>? environment,
    bool includeParentEnvironment = true,
    bool runInShell = false,
    String? description,
    Encoding encoding = utf8,
    bool forwardStdio = false}) async {
  var process = await Process.start(executable, arguments.toList(),
      workingDirectory: workingDirectory,
      environment: environment,
      includeParentEnvironment: includeParentEnvironment,
      runInShell: runInShell);

  if (description == null) {
    var humanExecutable = p.isWithin(p.current, executable)
        ? p.relative(executable)
        : executable;
    description = "$humanExecutable ${arguments.join(" ")}";
  }

  return TestProcess(process, description,
      encoding: encoding, forwardStdio: forwardStdio);
}