MeteorJSを使用しています。
javascriptサーバー側からbashコマンドを呼び出したいのですが。これはnodeJSで可能と思われます: http ://www.dzone.com/snippets/execute-unix-command-nodejs
しかし、meteorJSに似たものは見つかりません。私はそのようなものが欲しいです:
if(Meteor.isServer){
...
exec("myCommand");
}
MeteorJSを使用しています。
javascriptサーバー側からbashコマンドを呼び出したいのですが。これはnodeJSで可能と思われます: http ://www.dzone.com/snippets/execute-unix-command-nodejs
しかし、meteorJSに似たものは見つかりません。私はそのようなものが欲しいです:
if(Meteor.isServer){
...
exec("myCommand");
}
child_process.spawn()を使用することもできます。
Meteorを使用したUNIXコマンドの実行の詳細をご覧ください。
spawn = Npm.require('child_process').spawn;
command = spawn('ls', ['-la']);
command.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
command.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
command.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
サンプルからrequireの呼び出しを取得し、それらの前にプレフィックスを付ける場合
var sys = __meteor_bootstrap__.require('sys');
動作するはずです。