子stream程与meteor

我使用NodeJS的Child-Process来调用我的.exe,但现在我正在使用meteor。 我怎么能打电话给meteor的.exe。

这是Node中使用的代码

const exec = require('child_process').exec; exec('"C:\\Users\\obarrera\\Desktop\\desktop.exe" omar_barrera', (err, stdout, stderr) => { if (err) { console.error(err); return; } console.log(stdout); }); 

你可以做一些非常相似的meteor。 不过我build议把exe文件移到你的Meteor项目中。 如果将desktop.exe文件移动到项目中的private目录,则可以执行以下操作:

 import childProcess from 'child_process'; childProcess.exec('assets/app/desktop.exe omar_barrera', (err, stdout, stderr) => { if (err) { console.error(err); return; } console.log(stdout); }); 

当然,要确保你npm install --save child_process在你的Meteor项目中使用npm install --save child_process