2012-12-08 33 views

Trả lời

5

Nếu bạn dành cuộc gọi đến yêu cầu từ mẫu và tiền tố họ với

var sys = __meteor_bootstrap__.require('sys'); 

cần làm việc.

+5

Vì Meteor 0.6.0, nó sẽ giống như 'var sys = Npm.require ('sys');' – emgee

9

Bạn cũng có thể sử dụng child_process.spawn().

Read More about executing a UNIX command with Meteor.

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); 
}); 
Các vấn đề liên quan