我想使用NodeJS和NPM在此應用程序內重新啓動我的應用程序。使用NodeJS重新啓動當前實例
它不child_process
工作:
var exec = require('child_process').exec;
exec('npm restart', function(error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
你爲什麼需要重新啓動? –
我需要重新啓動我的腳本,因爲我正在編寫腳本以使用'GIT'獲取新版本的代碼,但第一步是瞭解如何自己重新啓動腳本... – tonymx227