runSync 静态方法

ProcessResult runSync(
  1. String executable,
  2. List<String> arguments,
  3. {String? workingDirectory,
  4. Map<String, String>? environment,
  5. bool includeParentEnvironment = true,
  6. bool runInShell = false,
  7. Encoding? stdoutEncoding = systemEncoding,
  8. Encoding? stderrEncoding = systemEncoding}
)

启动一个进程并运行到完成。这是一个同步调用,将阻塞直到子进程终止。

参数与 Process.run 的参数相同。

返回一个包含运行进程结果的 ProcessResult 对象,即退出代码,标准输出和标准输入。

实现

external static ProcessResult runSync(
    String executable, List<String> arguments,
    {String? workingDirectory,
    Map<String, String>? environment,
    bool includeParentEnvironment = true,
    bool runInShell = false,
    Encoding? stdoutEncoding = systemEncoding,
    Encoding? stderrEncoding = systemEncoding});