我想使用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