是否可以使用 Process.start() 设置环境变量?我试图从http://www.dartlang.org/articles/io/调整流程示例,但我收到错误。
Process.start("export my_key='abc123'", []).then((process) {
var stdoutStream = new StringInputStream(process.stdout);
stdoutStream.onLine = () => print(stdoutStream.readLine());
process.stderr.onData = process.stderr.read;
process.onExit = (exitCode) {
print('exit code: $exitCode');
};
错误:
Unhandled exception:
FutureUnhandledException: exception while executing Future
ProcessException: No such file or directory
Command: export my_key='abc123'
original stack trace:
null
#0 _FutureImpl._complete (bootstrap:844:11)
#1 _FutureImpl._complete (bootstrap:848:5)
#2 _FutureImpl._setException (bootstrap:873:14)
#3 _CompleterImpl.completeException (bootstrap:948:30)
#4 _ProcessImpl._start.<anonymous closure> (dart:io-patch:198:37)
#5 _Timer._createTimerHandler._handleTimeout (dart:io:6918:28)
#6 _Timer._createTimerHandler._handleTimeout (dart:io:6926:7)
#7 _Timer._createTimerHandler.<anonymous closure> (dart:io:6934:23)
#8 _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92)