1
我想運行一個腳本保存在/public/run.bat在我的流星項目目錄中。執行一個批處理腳本服務器端流星
在/server/main.js:
'callExe': function() {
var spawn = require('child_process').spawn,
ls = spawn('cmd.exe', ['/c', 'run.bat']);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
}
這是我的錯誤,
I20160510-00:02:09.762(-4)? stderr: 'run.bat' is not recognized as an
internal or external command,
I20160510-00:02:09.766(-4)? operable program or batch file.
I20160510-00:02:09.766(-4)?
I20160510-00:02:09.794(-4)? child process exited with code 1
雖然它運行時,我把它放在.meteor \本地\編譯\程序\服務器。 有人可以幫我解決這個問題嗎?