尝试直接从flutter应用程序启动节点服务,这是我的代码
Process.run(
'pm2',
['start', 'bin\www'],
runInShell: true,
includeParentEnvironment: true,
workingDirectory: 'E:\Works\PosApi\posapi',
).then((result) {
print("server started");
// print(result.pid);
}).catchError((err) {
print(
"node start- cath err");
});
请告诉我如何正确使用 process.run()
以前我用过
std::string start = base_directory + "\\node\\nodestart.bat";
ShellExecuteA(NULL, "open",start.c_str(), NULL,NULL, SW_HIDE);
在main.cpp / wWinMain()中 并在该bat文件中添加了运行正常的' cd / d E:\ Works \ PosApi \ posapi&pm2 start bin / www '。