Process.run(): 没有那个文件或目录

Process.run(): No such file or directory

我不明白,我做错了什么。我安装(激活)研磨机:

$ pub global activate grinder

然后我创建一个简单的 tool/grind.dart:

import "dart:io";
import "package:grinder/grinder.dart";

main(args) => grind(args);

@Task("Build")
build() {
  Process.run("webdev build", []);
}

但是 Process.run() 失败,没有这样的文件或目录错误:

$ grind build
ProcessException: No such file or directory
  Command: webdev build 
#0      build (...project/tool/grind.dart:33:3)
<asynchronous suspension>
#1      _LocalLibraryMirror._invoke (dart:mirrors/runtime/libmirrors_impl.dart:1104:36)
#2      _LocalObjectMirror.invoke (dart:mirrors/runtime/libmirrors_impl.dart:230:25)
#3      TaskDiscovery.discoverDeclaration.<anon> (package:grinder/src/discover_tasks.dart:79:38)
#4      _rootRun (dart:async/zone.dart:1124:13)
#5      _CustomZone.run (dart:async/zone.dart:1021:19)
#6      _runZoned (dart:async/zone.dart:1516:10)
#7      runZoned (dart:async/zone.dart:1463:12)
#8      ZonedValue.withValue (package:grinder/src/utils.dart:112:12)
#9      GrinderTask.execute (package:grinder/src/grinder_task.dart:64:27)
#10     Grinder._invokeTask (package:grinder/src/grinder.dart:193:27)
#11     Grinder.start.<anon> (package:grinder/src/grinder.dart:168:16)
#12     Future.forEach.<anon> (dart:async/future.dart:486:26)
#13     Future.doWhile.<anon> (dart:async/future.dart:528:26)
#14     _RootZone.runUnaryGuarded (dart:async/zone.dart:1314:10)
#15     _RootZone.bindUnaryCallbackGuarded.<anon> (dart:async/zone.dart:1353:26)
#16     Future.doWhile (dart:async/future.dart:543:18)
#17     Future.forEach (dart:async/future.dart:484:12)
#18     Grinder.start (package:grinder/src/grinder.dart:167:21)
#19     runTasks (package:grinder/src/cli.dart:67:39)
<asynchronous suspension>
#20     grind (package:grinder/grinder.dart:46:12)
#21     main (...project/tool/grind.dart:9:15)

即使 webdev 构建工作正常(在路径中)?:

$ webdev build
Creating build script
...

这里有什么问题?我该如何解决这个问题?或者有没有一种方法可以直接从 Dart 代码以编程方式调用 webdev 构建?

可执行文件不得包含参数。
改用:

Process.run("webdev", ["build"]);