Socket
Socket
Sign inDemoInstall

pm2

Package Overview
Dependencies
229
Maintainers
1
Versions
275
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.2.1 to 4.2.2

lib/ProcessContainerForkLegacy.js

2

lib/Daemon.js

@@ -48,3 +48,3 @@ /**

var path = cst.IS_WINDOWS ? process.cwd() + '/bin/pm2' : process.env['_'];
var path = cst.IS_WINDOWS ? __dirname + '/../bin/pm2' : process.env['_'];
var fork_new_pm2 = require('child_process').spawn('node', [path, 'update'], {

@@ -51,0 +51,0 @@ detached: true,

@@ -28,2 +28,3 @@ /**

var Configuration = require('./Configuration.js');
var semver = require('semver');

@@ -33,6 +34,14 @@ /**

*/
cluster.setupMaster({
windowsHide: true,
exec : path.resolve(path.dirname(module.filename), 'ProcessContainer.js')
});
if (semver.lt(process.version, '9.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')
});
}

@@ -39,0 +48,0 @@ /**

@@ -18,2 +18,3 @@ /**

var dateFns = require('date-fns')
var semver = require('semver')

@@ -58,3 +59,8 @@ /**

if (interpreter === 'node' || RegExp('node$').test(interpreter)) {
args.push(path.resolve(path.dirname(module.filename), '..', 'ProcessContainerFork.js'));
if (semver.lt(process.version, '9.0.0')) {
args.push(path.resolve(path.dirname(module.filename), '..', 'ProcessContainerForkLegacy.js'));
}
else {
args.push(path.resolve(path.dirname(module.filename), '..', 'ProcessContainerFork.js'));
}
}

@@ -61,0 +67,0 @@ else

@@ -15,2 +15,3 @@ /**

var Utility = require('./Utility.js');
var ProcessUtils = require('./ProcessUtils');

@@ -34,3 +35,3 @@ // Load all env-vars from master.

require('./ProcessUtils').injectModules();
ProcessUtils.injectModules()

@@ -299,3 +300,6 @@ var stdFile = pm2_env.pm_log_path;

require('module')._load(script, null, true);
if (ProcessUtils.isESModule(script) === true)
import(process.env.pm_exec_path);
else
require('module')._load(script, null, true);

@@ -302,0 +306,0 @@ function logError(types, error){

@@ -7,3 +7,4 @@ /**

// Inject custom modules
require('./ProcessUtils').injectModules();
var ProcessUtils = require('./ProcessUtils')
ProcessUtils.injectModules()

@@ -27,4 +28,9 @@ if (typeof(process.env.source_map_support) != "undefined" &&

// Require the real application
if (process.env.pm_exec_path)
require('module')._load(process.env.pm_exec_path, null, true);
if (process.env.pm_exec_path) {
if (ProcessUtils.isESModule(process.env.pm_exec_path) === true) {
import(process.env.pm_exec_path);
}
else
require('module')._load(process.env.pm_exec_path, null, true);
}
else

@@ -31,0 +37,0 @@ throw new Error('Could not _load() the script');

@@ -6,5 +6,5 @@ 'use strict'

if (process.env.pmx !== 'false') {
const pmx = require('@pm2/io');
const pmx = require('@pm2/io')
let conf = {};
let conf = {}
const hasSpecificConfig = typeof process.env.io === 'string' || process.env.trace === 'true'

@@ -15,4 +15,4 @@ // pmx is already init, no need to do it twice

if (process.env.io) {
const io = JSON.parse(process.env.io);
conf = io.conf ? io.conf : conf;
const io = JSON.parse(process.env.io)
conf = io.conf ? io.conf : conf
}

@@ -23,3 +23,34 @@ pmx.init(Object.assign({

}
},
isESModule(exec_path) {
var fs = require('fs')
var path = require('path')
var semver = require('semver')
var data
if (semver.satisfies(process.version, '< 13.3.0'))
return false
if (path.extname(exec_path) === '.mjs')
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) {
}
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
}
}
};
}
{
"name": "pm2",
"preferGlobal": true,
"version": "4.2.1",
"version": "4.2.2",
"engines": {

@@ -6,0 +6,0 @@ "node": ">=8.10.0"

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc