Skip to content

Commit

Permalink
fix: node@10 support back in
Browse files Browse the repository at this point in the history
Can't use .? so we use undefsafe
  • Loading branch information
remy committed Jul 7, 2023
1 parent a3f0e12 commit af3b9e2
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/monitor/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var restart = null;
var psTree = require('pstree.remy');
var path = require('path');
var signals = require('./signals');
const undefsafe = require('undefsafe');
const osRelease = parseInt(require('os').release().split('.')[0], 10);

function run(options) {
Expand Down Expand Up @@ -64,7 +65,10 @@ function run(options) {

const spawnOptions = {
env: Object.assign({}, process.env, options.execOptions.env, {
PATH: binPath + path.delimiter + options.execOptions.env?.PATH || process.env.PATH,
PATH:
binPath +
path.delimiter +
(undefsafe(options, '.execOptions.env.PATH') || process.env.PATH),
}),
stdio: stdio,
};
Expand Down Expand Up @@ -129,7 +133,7 @@ function run(options) {
silent: !hasStdio,
};
if (utils.isWindows) {
forkOptions.windowsHide = true;
forkOptions.windowsHide = true;
}
child = fork(options.execOptions.script, forkArgs, forkOptions);
utils.log.detail('forking');
Expand Down Expand Up @@ -341,7 +345,12 @@ function kill(child, signal, callback) {
// We are handling a 'SIGKILL' , 'SIGUSR2' and 'SIGUSR1' POSIX signal under Windows the
// same way it is handled on a UNIX system: We are performing
// a hard shutdown without waiting for the process to clean-up.
if (signal === 'SIGKILL' || osRelease < 10 || signal === 'SIGUSR2' || signal==="SIGUSR1" ) {
if (
signal === 'SIGKILL' ||
osRelease < 10 ||
signal === 'SIGUSR2' ||
signal === 'SIGUSR1'
) {
debug('terminating process group by force: %s', child.pid);

// We are using the taskkill utility to terminate the whole
Expand Down

0 comments on commit af3b9e2

Please sign in to comment.