mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
This commit is contained in:
parent
b2292038d6
commit
618862fb4e
@ -268,7 +268,18 @@ UX.dispKeys = function(kv, target_module) {
|
||||
});
|
||||
}
|
||||
|
||||
var defaultSpinnerString = '|/-\\';
|
||||
var defaultSpinnerString = [
|
||||
"⠋",
|
||||
"⠙",
|
||||
"⠹",
|
||||
"⠸",
|
||||
"⠼",
|
||||
"⠴",
|
||||
"⠦",
|
||||
"⠧",
|
||||
"⠇",
|
||||
"⠏"
|
||||
].join('');
|
||||
|
||||
var Spinner = function(textToShow){
|
||||
this.text = textToShow || '';
|
||||
@ -305,22 +316,10 @@ Spinner.prototype.stop = function() {
|
||||
clearInterval(this.id);
|
||||
};
|
||||
|
||||
UX.dotSpinner = {
|
||||
start : function() {
|
||||
this.interval = setInterval(function() {
|
||||
console.log('asddsa');
|
||||
process.stdout.write('.');
|
||||
}, 100);
|
||||
},
|
||||
stop : function() {
|
||||
clearInterval(this.interval);
|
||||
}
|
||||
};
|
||||
|
||||
UX.processing = {
|
||||
current_spinner : null,
|
||||
start : function() {
|
||||
this.current_spinner = new Spinner('Connecting...');
|
||||
start : function(text) {
|
||||
this.current_spinner = new Spinner(text || 'Connecting...');
|
||||
this.current_spinner.start();
|
||||
},
|
||||
stop : function() {
|
||||
|
||||
@ -106,17 +106,16 @@ function installModule(module_name, cb) {
|
||||
* Production mode
|
||||
*/
|
||||
|
||||
Common.printOut(cst.PREFIX_MSG_MOD + 'Processing...');
|
||||
var inter = setInterval(function() {
|
||||
process.stdout.write('.');
|
||||
}, 500);
|
||||
UX.processing.start('Downloading module');
|
||||
|
||||
shelljs.exec('npm install ' + module_name + ' --prefix ' + cst.PM2_ROOT_PATH, {silent : true}, function(code) {
|
||||
clearInterval(inter);
|
||||
var command = 'npm install ' + module_name + ' --prefix ' + cst.PM2_ROOT_PATH;
|
||||
|
||||
shelljs.exec(command, {async : true}, function(code, out, err) {
|
||||
UX.processing.stop();
|
||||
|
||||
if (code != 0) {
|
||||
Common.printError(cst.PREFIX_MSG_MOD_ERR + 'Unknown module');
|
||||
return cb({msg:'Unknown module'});
|
||||
Common.printError(cst.PREFIX_MSG_MOD_ERR + 'Installation failed');
|
||||
return cb(new Error(err));
|
||||
}
|
||||
|
||||
Common.printOut(cst.PREFIX_MSG_MOD + 'Module downloaded');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user