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 ' 工作正常。
解决方案
推荐阅读
- php - PHP - 将字符串拆分为每 N 个字符的数组
- java - 时间窗的 Optaplanner 约束
- android - Android VM:avd 可以在带有 Hyper-V 的主机上运行吗?
- arrays - 具有引用类型项目的 Swift 数组的 CoW(写入时复制)异常
- python - 如何使用_string_方法创建一个空字符串来插入稀疏向量数据
- reactjs - 状态更新不会触发条件渲染组件中的重新渲染
- reactjs - 语法错误:使用 React.lazy() 方法导入组件时出现意外标记
- python - 行理解在 python 中无法正常运行
- ios - Swift 5 如何从 URL 获取 HTML
- github - 使用使用过的 Macbook 设置 Github