Comparing version 5.1.2 to 5.2.0
/** | ||
* Copyright 2013 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -112,2 +112,2 @@ * can be found in the LICENSE file. | ||
module.exports = util._extend(csts, path_structure); | ||
module.exports = Object.assign(csts, path_structure); |
/** | ||
* Copyright 2013 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -30,3 +30,2 @@ * can be found in the LICENSE file. | ||
var Configuration = require('./Configuration.js'); | ||
const semver = require('semver') | ||
const sexec = require('./tools/sexec.js') | ||
@@ -85,3 +84,3 @@ | ||
this.pm2_home = opts.pm2_home; | ||
conf = util._extend(conf, path_structure(this.pm2_home)); | ||
conf = Object.assign(conf, path_structure(this.pm2_home)); | ||
} | ||
@@ -98,3 +97,3 @@ else if (opts.independent == true && conf.IS_WINDOWS === false) { | ||
this.daemon_mode = false; | ||
conf = util._extend(conf, path_structure(this.pm2_home)); | ||
conf = Object.assign(conf, path_structure(this.pm2_home)); | ||
} | ||
@@ -328,6 +327,2 @@ | ||
if (semver.lt(process.version, '6.0.0')) { | ||
Common.printOut(conf.PREFIX_MSG_WARNING + 'Node 4 is deprecated, please upgrade to use pm2 to have all features'); | ||
} | ||
var that = this; | ||
@@ -883,3 +878,3 @@ if (util.isArray(opts.watch) && opts.watch.length === 0) | ||
var additional_env = Modularizer.getAdditionalConf(resolved_paths.name); | ||
util._extend(resolved_paths.env, additional_env); | ||
Object.assign(resolved_paths.env, additional_env); | ||
@@ -1080,3 +1075,3 @@ // Is KM linked? | ||
var env = envs.reduce(function(e1, e2){ | ||
return util._extend(e1, e2); | ||
return Object.assign(e1, e2); | ||
}); | ||
@@ -1156,3 +1151,3 @@ | ||
var additional_env = Modularizer.getAdditionalConf(resolved_paths.name); | ||
util._extend(resolved_paths.env, additional_env); | ||
Object.assign(resolved_paths.env, additional_env); | ||
@@ -1378,3 +1373,3 @@ resolved_paths.env = Common.mergeEnvironmentVariables(resolved_paths, opts.env, deployConf); | ||
else | ||
new_env = util._extend({}, process.env); | ||
new_env = Object.assign({}, process.env); | ||
@@ -1521,3 +1516,3 @@ Object.keys(envs).forEach(function(k) { | ||
var additional_env = Modularizer.getAdditionalConf(process_name); | ||
util._extend(envs, additional_env); | ||
Object.assign(envs, additional_env); | ||
return processIds(ids, cb); | ||
@@ -1541,3 +1536,3 @@ } | ||
var ns_additional_env = Modularizer.getAdditionalConf(process_name); | ||
util._extend(envs, ns_additional_env); | ||
Object.assign(envs, ns_additional_env); | ||
return processIds(ns_process_ids, cb); | ||
@@ -1544,0 +1539,0 @@ }); |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
@@ -17,3 +17,2 @@ | ||
var pkg = require('../../package.json'); | ||
const semver = require('semver'); | ||
const copyDirSync = require('../tools/copydirSync.js') | ||
@@ -105,2 +104,3 @@ | ||
that.Client.executeRemote('getReport', {}, function(err, report) { | ||
console.log() | ||
@@ -113,13 +113,16 @@ console.log() | ||
fmt.sep(); | ||
fmt.title(chalk.bold.blue('Daemon')); | ||
fmt.field('pm2d version', report.pm2_version); | ||
fmt.field('node version', report.node_version); | ||
fmt.field('node path', report.node_path); | ||
fmt.field('argv', report.argv); | ||
fmt.field('argv0', report.argv0); | ||
fmt.field('user', report.user); | ||
fmt.field('uid', report.uid); | ||
fmt.field('gid', report.gid); | ||
fmt.field('uptime', dayjs(new Date()).diff(report.started_at, 'minute') + 'min'); | ||
if (report && !err) { | ||
fmt.title(chalk.bold.blue('Daemon')); | ||
fmt.field('pm2d version', report.pm2_version); | ||
fmt.field('node version', report.node_version); | ||
fmt.field('node path', report.node_path); | ||
fmt.field('argv', report.argv); | ||
fmt.field('argv0', report.argv0); | ||
fmt.field('user', report.user); | ||
fmt.field('uid', report.uid); | ||
fmt.field('gid', report.gid); | ||
fmt.field('uptime', dayjs(new Date()).diff(report.started_at, 'minute') + 'min'); | ||
} | ||
fmt.sep(); | ||
@@ -279,5 +282,6 @@ fmt.title(chalk.bold.blue('CLI')); | ||
var enquirer = require('enquirer') | ||
const forEach = require('async/forEach') | ||
fs.readdir(path.join(__dirname, '../templates/sample-apps'), (err, items) => { | ||
require('async').forEach(items, (app, next) => { | ||
forEach(items, (app, next) => { | ||
var fp = path.join(__dirname, '../templates/sample-apps', app) | ||
@@ -760,22 +764,17 @@ fs.readFile(path.join(fp, 'package.json'), (err, dt) => { | ||
const that = this; | ||
if(semver.satisfies(process.versions.node, '>= 8.0.0')) { | ||
this.trigger(app_name, 'internal:inspect', function (err, res) { | ||
this.trigger(app_name, 'internal:inspect', function (err, res) { | ||
if(res && res[0]) { | ||
if (res[0].data.return === '') { | ||
Common.printOut(`Inspect disabled on ${app_name}`); | ||
} else { | ||
Common.printOut(`Inspect enabled on ${app_name} => go to chrome : chrome://inspect !!!`); | ||
} | ||
if(res && res[0]) { | ||
if (res[0].data.return === '') { | ||
Common.printOut(`Inspect disabled on ${app_name}`); | ||
} else { | ||
Common.printOut(`Unable to activate inspect mode on ${app_name} !!!`); | ||
Common.printOut(`Inspect enabled on ${app_name} => go to chrome : chrome://inspect !!!`); | ||
} | ||
} else { | ||
Common.printOut(`Unable to activate inspect mode on ${app_name} !!!`); | ||
} | ||
that.exitCli(cst.SUCCESS_EXIT); | ||
}); | ||
} else { | ||
Common.printOut('Inspect is available for node version >=8.x !'); | ||
that.exitCli(cst.SUCCESS_EXIT); | ||
} | ||
}); | ||
}; | ||
}; |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
@@ -6,3 +6,4 @@ | ||
var forEachLimit = require('async/forEachLimit'); | ||
const sexec = require('../../tools/sexec.js') | ||
const sexec = require('../../tools/sexec.js'); | ||
const deleteFolderRecursive = require('../../tools/deleteFolderRecursive.js'); | ||
@@ -112,3 +113,3 @@ var path = require('path'); | ||
var sanitized = module_name.replace(/\./g, '') | ||
execSync(`rm -r ${path.join(cst.DEFAULT_MODULE_PATH, module_name)}`, { silent: true }) | ||
deleteFolderRecursive(path.join(cst.DEFAULT_MODULE_PATH, module_name)); | ||
} | ||
@@ -115,0 +116,0 @@ |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
@@ -11,3 +11,3 @@ | ||
const exec = require('child_process').exec | ||
const async = require('async') | ||
const tryEach = require('async/tryEach'); | ||
@@ -57,3 +57,3 @@ module.exports = class WebStrategy extends AuthStrategy { | ||
} | ||
async.tryEach([ | ||
tryEach([ | ||
// try to find the token via the environment | ||
@@ -60,0 +60,0 @@ (next) => { |
@@ -8,3 +8,2 @@ | ||
const open = require('../../tools/open.js'); | ||
const semver = require('semver'); | ||
const Modules = require('../Modules'); | ||
@@ -41,6 +40,2 @@ | ||
if (semver.satisfies(process.version, '< 10.0.0')) { | ||
modules.push('v8-profiler-node8') | ||
} | ||
forEach(modules, (_module, next) => { | ||
@@ -69,5 +64,2 @@ Modules.uninstall(this, _module, () => { | ||
modules = ['pm2-logrotate', 'pm2-server-monit'] | ||
if (semver.satisfies(process.version, '< 8.0.0')) { | ||
modules.push('v8-profiler-node8') | ||
} | ||
if (opts.type === 'enterprise') { | ||
@@ -74,0 +66,0 @@ modules.push('deep-metrics') |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -13,15 +13,9 @@ * can be found in the LICENSE file. | ||
var debug = require('debug')('pm2:serve'); | ||
var semver = require('semver') | ||
var isNode4 = require('semver').lt(process.version, '6.0.0') | ||
if (!isNode4) { | ||
var probe = require('@pm2/io'); | ||
var errorMeter = probe.meter({ | ||
name : '404/sec', | ||
samples : 1, | ||
timeframe : 60 | ||
}) | ||
} | ||
var probe = require('@pm2/io'); | ||
var errorMeter = probe.meter({ | ||
name : '404/sec', | ||
samples : 1, | ||
timeframe : 60 | ||
}) | ||
/** | ||
@@ -276,8 +270,7 @@ * list of supported content types. | ||
if (error) { | ||
if ((!options.spa || request.wantHomepage)) { | ||
if ((!options.spa || file === options.homepage)) { | ||
console.error('[%s] Error while serving %s with content-type %s : %s', | ||
new Date(), filePath, contentType, error.message || error); | ||
} | ||
if (!isNode4) | ||
errorMeter.mark(); | ||
errorMeter.mark(); | ||
if (error.code === 'ENOENT') { | ||
@@ -300,3 +293,9 @@ if (options.spa && !request.wantHomepage) { | ||
} | ||
response.writeHead(200, { 'Content-Type': contentType }); | ||
// Add CORS headers to allow browsers to fetch data directly | ||
response.writeHead(200, { | ||
'Content-Type': contentType, | ||
'Access-Control-Allow-Origin': '*', | ||
'Access-Control-Allow-Methods': 'GET' | ||
}); | ||
if (options.monitorBucket && contentType === 'text/html') { | ||
@@ -303,0 +302,0 @@ content = content.toString().replace('</body>', ` |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -278,2 +278,3 @@ * can be found in the LICENSE file. | ||
commands = [ | ||
'mkdir -p ' + path.join(process.env.HOME, 'Library/LaunchAgents'), | ||
'launchctl load -w ' + destination | ||
@@ -280,0 +281,0 @@ ] |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -260,5 +260,5 @@ * can be found in the LICENSE file. | ||
windowsHide: true, | ||
env : util._extend({ | ||
'SILENT' : that.conf.DEBUG ? !that.conf.DEBUG : true, | ||
'PM2_HOME' : that.pm2_home | ||
env : Object.assign({ | ||
'SILENT' : that.conf.DEBUG ? !that.conf.DEBUG : true, | ||
'PM2_HOME' : that.pm2_home | ||
}, process.env), | ||
@@ -265,0 +265,0 @@ stdio : ['ipc', out, err] |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -211,3 +211,3 @@ * can be found in the LICENSE file. | ||
].reduce(function(e1, e2){ | ||
return util._extend(e1, e2); | ||
return Object.assign(e1, e2); | ||
}); | ||
@@ -333,4 +333,2 @@ | ||
Common.sink.determineCron = function(app) { | ||
var cronJob = require('cron').CronJob; | ||
if (app.cron_restart == 0 || app.cron_restart == '0') { | ||
@@ -342,7 +340,7 @@ Common.printOut(cst.PREFIX_MSG + 'disabling cron restart'); | ||
if (app.cron_restart) { | ||
const Croner = require('croner'); | ||
try { | ||
Common.printOut(cst.PREFIX_MSG + 'cron restart at ' + app.cron_restart); | ||
new cronJob(app.cron_restart, function() { | ||
Common.printOut(cst.PREFIX_MSG + 'cron pattern for auto restart detected and valid'); | ||
}); | ||
Croner(app.cron_restart); | ||
} catch(ex) { | ||
@@ -599,3 +597,3 @@ return new Error(`Cron pattern error: ${ex.message}`); | ||
*/ | ||
util._extend(new_conf, app) | ||
Object.assign(new_conf, app); | ||
@@ -605,10 +603,10 @@ if (env_name) { | ||
if (deploy_conf && deploy_conf[env_name] && deploy_conf[env_name]['env']) { | ||
util._extend(new_conf.env, deploy_conf[env_name]['env']); | ||
Object.assign(new_conf.env, deploy_conf[env_name]['env']); | ||
} | ||
util._extend(new_conf.env, app.env); | ||
Object.assign(new_conf.env, app.env); | ||
// Then, last and highest priority, merge the app.env_production object. | ||
if ('env_' + env_name in app) { | ||
util._extend(new_conf.env, app['env_' + env_name]); | ||
Object.assign(new_conf.env, app['env_' + env_name]); | ||
} | ||
@@ -626,4 +624,4 @@ else { | ||
util._extend(res, new_conf.env) | ||
util._extend(res.current_conf, new_conf) | ||
Object.assign(res, new_conf.env); | ||
Object.assign(res.current_conf, new_conf); | ||
@@ -736,3 +734,3 @@ // #2541 force resolution of node interpreter | ||
*/ | ||
if (app.time) { | ||
if (app.time || process.env.ASZ_MODE) { | ||
app.log_date_format = 'YYYY-MM-DDTHH:mm:ss' | ||
@@ -739,0 +737,0 @@ } |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -429,3 +429,3 @@ * can be found in the LICENSE file. | ||
util._extend(God.clusters_db[msg.process.pm_id].pm2_env.axm_monitor, Utility.clone(msg.data)); | ||
Object.assign(God.clusters_db[msg.process.pm_id].pm2_env.axm_monitor, Utility.clone(msg.data)); | ||
msg = null; | ||
@@ -432,0 +432,0 @@ }); |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -28,3 +28,2 @@ * can be found in the LICENSE file. | ||
var Configuration = require('./Configuration.js'); | ||
var semver = require('semver'); | ||
@@ -34,14 +33,6 @@ /** | ||
*/ | ||
if (semver.lt(process.version, '10.0.0')) { | ||
cluster.setupMaster({ | ||
windowsHide: true, | ||
exec : path.resolve(path.dirname(module.filename), 'ProcessContainerLegacy.js') | ||
}); | ||
} | ||
else { | ||
cluster.setupMaster({ | ||
windowsHide: true, | ||
exec : path.resolve(path.dirname(module.filename), 'ProcessContainer.js') | ||
}); | ||
} | ||
cluster.setupMaster({ | ||
windowsHide: true, | ||
exec : path.resolve(path.dirname(module.filename), 'ProcessContainer.js') | ||
}); | ||
@@ -48,0 +39,0 @@ /** |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -58,8 +58,3 @@ * can be found in the LICENSE file. | ||
if (interpreter === 'node' || RegExp('node$').test(interpreter)) { | ||
if (semver.lt(process.version, '10.0.0')) { | ||
args.push(path.resolve(path.dirname(module.filename), '..', 'ProcessContainerForkLegacy.js')); | ||
} | ||
else { | ||
args.push(path.resolve(path.dirname(module.filename), '..', 'ProcessContainerFork.js')); | ||
} | ||
args.push(path.resolve(path.dirname(module.filename), '..', 'ProcessContainerFork.js')); | ||
} | ||
@@ -66,0 +61,0 @@ else |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
@@ -28,2 +28,14 @@ 'use strict' | ||
var findPackageJson = function(directory) { | ||
var file = path.join(directory, 'package.json') | ||
if (fs.existsSync(file) && fs.statSync(file).isFile()) { | ||
return file; | ||
} | ||
var parent = path.resolve(directory, '..') | ||
if (parent === directory) { | ||
return null; | ||
} | ||
return findPackageJson(parent) | ||
} | ||
if (semver.satisfies(process.version, '< 13.3.0')) | ||
@@ -36,3 +48,3 @@ return false | ||
try { | ||
data = JSON.parse(fs.readFileSync(path.join(path.dirname(exec_path), 'package.json'))) | ||
data = JSON.parse(fs.readFileSync(findPackageJson(path.dirname(exec_path)))) | ||
if (data.type === 'module') | ||
@@ -44,13 +56,3 @@ return true | ||
} | ||
try { | ||
data = JSON.parse(fs.readFileSync(path.join(path.dirname(exec_path), '..', 'package.json'))) | ||
if (data.type === 'module') | ||
return true | ||
else | ||
return false | ||
} catch(e) { | ||
return false | ||
} | ||
} | ||
} |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -84,3 +84,3 @@ * can be found in the LICENSE file. | ||
// clone config | ||
var conf = util._extend({}, json), | ||
var conf = Object.assign({}, json), | ||
res = {}; | ||
@@ -87,0 +87,0 @@ this._errors = []; |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -101,3 +101,3 @@ * can be found in the LICENSE file. | ||
function timestamp(){ | ||
return `${dayjs(Date.now()).format('YYYY-MM-DDTHH:mm:ss')}:`; | ||
return `${dayjs(Date.now()).format(cst.PM2_LOG_DATE_FORMAT)}:`; | ||
} | ||
@@ -104,0 +104,0 @@ |
@@ -5,3 +5,2 @@ | ||
var fs = require('fs') | ||
var cst = require('../constants.js') | ||
var os = require('os') | ||
@@ -8,0 +7,0 @@ |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -45,3 +45,3 @@ * can be found in the LICENSE file. | ||
if (pm2_env.watch_options) { | ||
watch_options = util._extend(watch_options, pm2_env.watch_options); | ||
watch_options = Object.assign(watch_options, pm2_env.watch_options); | ||
} | ||
@@ -48,0 +48,0 @@ |
/** | ||
* Copyright 2013-2021 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
* can be found in the LICENSE file. | ||
*/ | ||
var vizion = require('vizion'); | ||
var cst = require('../constants.js'); | ||
var eachLimit = require('async/eachLimit'); | ||
var debug = require('debug')('pm2:worker'); | ||
var domain = require('domain'); | ||
var cronJob = require('cron').CronJob | ||
const vizion = require('vizion'); | ||
const eachLimit = require('async/eachLimit'); | ||
const debug = require('debug')('pm2:worker'); | ||
const domain = require('domain'); | ||
const Cron = require('croner'); | ||
const pkg = require('../package.json'); | ||
var cst = require('../constants.js'); | ||
var vCheck = require('./VersionCheck.js') | ||
var pkg = require('../package.json') | ||
@@ -37,15 +38,10 @@ module.exports = function(God) { | ||
var job = new cronJob({ | ||
cronTime: pm2_env.cron_restart, | ||
onTick: function() { | ||
God.restartProcessId({id: pm_id}, function(err, data) { | ||
if (err) | ||
console.error(err.stack || err); | ||
return; | ||
}); | ||
}, | ||
start: false | ||
var job = Cron(pm2_env.cron_restart, function() { | ||
God.restartProcessId({id: pm_id}, function(err, data) { | ||
if (err) | ||
console.error(err.stack || err); | ||
return; | ||
}); | ||
}); | ||
job.start(); | ||
God.CronJobs.set(God.getCronID(pm_id), job); | ||
@@ -63,3 +59,6 @@ } | ||
var job = God.CronJobs.get(God.getCronID(id)); | ||
job.stop(); | ||
if (job) | ||
job.stop(); | ||
God.CronJobs.delete(God.getCronID(id)); | ||
@@ -66,0 +65,0 @@ }; |
{ | ||
"name": "pm2", | ||
"preferGlobal": true, | ||
"version": "5.1.2", | ||
"version": "5.2.0", | ||
"engines": { | ||
@@ -179,3 +179,3 @@ "node": ">=10.0.0" | ||
"commander": "2.15.1", | ||
"cron": "1.8.2", | ||
"croner": "~4.1.92", | ||
"dayjs": "~1.8.25", | ||
@@ -189,3 +189,3 @@ "debug": "^4.3.1", | ||
"needle": "2.4.0", | ||
"pidusage": "2.0.21", | ||
"pidusage": "~3.0", | ||
"pm2-axon": "~4.0.1", | ||
@@ -205,3 +205,3 @@ "pm2-axon-rpc": "~0.7.1", | ||
"devDependencies": { | ||
"mocha": "^8.3.2", | ||
"mocha": "^9.1.3", | ||
"should": "^13.2.3" | ||
@@ -208,0 +208,0 @@ }, |
/** | ||
* Copyright 2013 the PM2 project authors. All rights reserved. | ||
* Copyright 2013-2022 the PM2 project authors. All rights reserved. | ||
* Use of this source code is governed by a license that | ||
@@ -4,0 +4,0 @@ * can be found in the LICENSE file. |
<div align="center"> | ||
<br/> | ||
<a href="http://pm2.keymetrics.io/" title="PM2 Keymetrics link"> | ||
<img width=710px src="https://raw.githubusercontent.com/Unitech/pm2/development/pres/pm2-v4.png" alt="pm2 logo"> | ||
<img width=710px src="https://raw.githubusercontent.com/Unitech/pm2/master/pres/pm2-v4.png" alt="pm2 logo"> | ||
</a> | ||
@@ -43,3 +43,3 @@ <br/> | ||
PM2 is constantly assailed by [more than 1800 tests](https://travis-ci.org/Unitech/pm2). | ||
PM2 is constantly assailed by [more than 1800 tests](https://app.travis-ci.com/github/Unitech/pm2). | ||
@@ -195,3 +195,3 @@ Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/) | ||
PM2 can generates and configure a Startup Script to keep PM2 and your processes alive at every server restart. | ||
PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart. | ||
@@ -198,0 +198,0 @@ Init Systems Supported: **systemd**, **upstart**, **launchd**, **rc.d** |
@@ -309,2 +309,6 @@ // Type definitions for pm2 2.7.1 | ||
/** | ||
* Enable or disable auto restart after process failure (default: true). | ||
*/ | ||
autorestart?: boolean; | ||
/** | ||
* An arbitrary name that can be used to interact with (e.g. restart) the process | ||
@@ -367,2 +371,10 @@ * later in other commands. Defaults to the script name without its extension | ||
/** | ||
* Arguments to pass to the interpreter | ||
*/ | ||
node_args?: string | string[]; | ||
/** | ||
* Prefix logs with time | ||
*/ | ||
time?: boolean; | ||
/** | ||
* This will make PM2 listen for that event. In your application you will need to add process.send('ready'); | ||
@@ -369,0 +381,0 @@ * when you want your application to be considered as ready. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303
792437
125
17367
+ Addedcroner@~4.1.92
+ Addedcroner@4.1.97(transitive)
+ Addedpidusage@3.0.2(transitive)
- Removedcron@1.8.2
- Removedcron@1.8.2(transitive)
- Removedmoment@2.30.1(transitive)
- Removedmoment-timezone@0.5.45(transitive)
Updatedpidusage@~3.0