Merge branch 'development'

This commit is contained in:
Unitech 2023-02-18 16:32:53 +01:00
commit d61f139553
7 changed files with 24 additions and 15 deletions

View File

@ -1,6 +1,7 @@
language: node_js
dist: focal
node_js:
- "19"
- "18"
- "16"
- "14"

View File

@ -150,7 +150,7 @@ API.prototype.connect = function(noDaemon, cb) {
return cb(err, meta);
// If new pm2 instance has been popped
// Lauch all modules
// Launch all modules
Modularizer.launchAll(that, function(err_mod) {
return cb(err, meta);
});

View File

@ -182,7 +182,7 @@ class API {
that.launchSysMonitoring(() => {})
// If new pm2 instance has been popped
// Lauch all modules
// Launch all modules
that.launchAll(that, function(err_mod) {
return cb(err, meta);
});

View File

@ -41,21 +41,23 @@ module.exports = function(CLI) {
fs.closeSync(fs.openSync(l.pm2_env.pm_out_log_path, 'w'));
fs.closeSync(fs.openSync(l.pm2_env.pm_err_log_path, 'w'));
}
else if (l.pm2_env.name === api) {
else if (l.pm2_env.pm_id == api || l.pm2_env.name === api) {
Common.printOut(cst.PREFIX_MSG + 'Flushing:');
Common.printOut(cst.PREFIX_MSG + l.pm2_env.pm_out_log_path);
Common.printOut(cst.PREFIX_MSG + l.pm2_env.pm_err_log_path);
if (l.pm2_env.pm_log_path &&
l.pm2_env.pm_log_path.lastIndexOf('/') < l.pm2_env.pm_log_path.lastIndexOf(api)) {
if (l.pm2_env.pm_log_path && fs.existsSync(l.pm2_env.pm_log_path)) {
Common.printOut(cst.PREFIX_MSG + l.pm2_env.pm_log_path);
fs.closeSync(fs.openSync(l.pm2_env.pm_log_path, 'w'));
}
if (l.pm2_env.pm_out_log_path.lastIndexOf('/') < l.pm2_env.pm_out_log_path.lastIndexOf(api))
if (l.pm2_env.pm_out_log_path && fs.existsSync(l.pm2_env.pm_out_log_path)) {
Common.printOut(cst.PREFIX_MSG + l.pm2_env.pm_out_log_path);
fs.closeSync(fs.openSync(l.pm2_env.pm_out_log_path, 'w'));
if (l.pm2_env.pm_err_log_path.lastIndexOf('/') < l.pm2_env.pm_err_log_path.lastIndexOf(api))
}
if (l.pm2_env.pm_err_log_path && fs.existsSync(l.pm2_env.pm_err_log_path)) {
Common.printOut(cst.PREFIX_MSG + l.pm2_env.pm_err_log_path);
fs.closeSync(fs.openSync(l.pm2_env.pm_err_log_path, 'w'));
}
}
});

View File

@ -44,8 +44,13 @@ function listModulesAndAppsManaged(list, commander) {
if (list && list.length > 0)
name_col_size = (list.reduce((p, c) => (p.name.length > c.name.length) ? p : c)).name.length + 5
var id_width = Math.max(
2 + (Math.max(...list.map((l) => String(l.pm2_env.pm_id || 0).length)) || 0),
4
);
var app_head = {
id: 5,
id: id_width,
name: name_col_size,
namespace: 13,
version: 9,
@ -61,7 +66,7 @@ function listModulesAndAppsManaged(list, commander) {
}
var mod_head = {
id: 4,
id: id_width,
module: 30,
version: 15,
pid: 10,
@ -74,7 +79,7 @@ function listModulesAndAppsManaged(list, commander) {
if (CONDENSED_MODE) {
app_head = {
id: 4,
id: id_width,
name: 20,
mode: 10,
'↺': 6,
@ -84,7 +89,7 @@ function listModulesAndAppsManaged(list, commander) {
}
mod_head = {
id: 4,
id: id_width,
name: 20,
status: 10,
cpu: 10,

View File

@ -13,6 +13,7 @@ var p = require('path');
var cst = require('../constants');
var Utility = require('./Utility.js');
var ProcessUtils = require('./ProcessUtils');
var Url = require('url');
// Load all env-vars from master.
var pm2_env = JSON.parse(process.env.pm2_env);
@ -298,7 +299,7 @@ function exec(script, stds) {
process.chdir(pm2_env.pm_cwd || process.env.PWD || p.dirname(script));
if (ProcessUtils.isESModule(script) === true)
import(process.env.pm_exec_path);
import(Url.pathToFileURL(process.env.pm_exec_path));
else
require('module')._load(script, null, true);

View File

@ -881,7 +881,7 @@ commander.command('logs [id|name|namespace]')
.option('--out', 'only shows standard output')
.option('--lines <n>', 'output the last N lines, instead of the last 15 by default')
.option('--timestamp [format]', 'add timestamps (default format YYYY-MM-DD-HH:mm:ss)')
.option('--nostream', 'print logs without lauching the log stream')
.option('--nostream', 'print logs without launching the log stream')
.option('--highlight [value]', 'highlights the given value')
.description('stream logs file. Default stream all logs')
.action(function(id, cmd) {