Skip to content

Commit 7c1f969

Browse files
committed
no more shell: true + remove util._extends
1 parent e007774 commit 7c1f969

4 files changed

Lines changed: 13 additions & 20 deletions

File tree

lib/API/Modules/LOCAL.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ function installLangModule(module_name, cb) {
106106
var install_instance = spawn(cst.IS_WINDOWS ? 'npm.cmd' : 'npm', ['install', module_name, '--loglevel=error'], {
107107
stdio : 'inherit',
108108
env: process.env,
109-
shell : true,
110109
cwd : node_module_path
111110
});
112111

lib/API/Modules/NPM.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,27 +180,24 @@ function install(CLI, module_name, opts, cb) {
180180
// Builtin Node Switch
181181
function getNPMCommandLine(module_name, install_path) {
182182
if (which('bun')) {
183-
return spawn.bind(this, 'bun', ['install', module_name, '--loglevel=error', '--cwd', `"${install_path}"` ], {
183+
return spawn.bind(this, 'bun', ['install', module_name, '--loglevel=error', '--cwd', install_path], {
184184
stdio : 'inherit',
185185
env: process.env,
186-
windowsHide: true,
187-
shell : true
186+
windowsHide: true
188187
})
189188
}
190189
else if (which('npm')) {
191-
return spawn.bind(this, cst.IS_WINDOWS ? 'npm.cmd' : 'npm', ['install', module_name, '--loglevel=error', '--prefix', `"${install_path}"` ], {
190+
return spawn.bind(this, cst.IS_WINDOWS ? 'npm.cmd' : 'npm', ['install', module_name, '--loglevel=error', '--prefix', install_path], {
192191
stdio : 'inherit',
193192
env: process.env,
194-
windowsHide: true,
195-
shell : true
193+
windowsHide: true
196194
})
197195
}
198196
else {
199-
return spawn.bind(this, cst.BUILTIN_NODE_PATH, [cst.BUILTIN_NPM_PATH, 'install', module_name, '--loglevel=error', '--prefix', `"${install_path}"`], {
197+
return spawn.bind(this, cst.BUILTIN_NODE_PATH, [cst.BUILTIN_NPM_PATH, 'install', module_name, '--loglevel=error', '--prefix', install_path], {
200198
stdio : 'inherit',
201199
env: process.env,
202-
windowsHide: true,
203-
shell : true
200+
windowsHide: true
204201
})
205202
}
206203
}

lib/API/Modules/TAR.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ function retrieveRemote(url, dest, cb) {
5858
var wget = spawn('wget', [url, '-O', dest, '-q'], {
5959
stdio : 'inherit',
6060
env: process.env,
61-
windowsHide: true,
62-
shell : true
61+
windowsHide: true
6362
})
6463

6564
wget.on('error', (err) => {
@@ -88,10 +87,9 @@ function installLocal(PM2, module_filepath, opts, cb) {
8887

8988
fs.mkdirSync(install_path, { recursive: true })
9089

91-
var install_instance = spawn('tar', ['zxf', module_filepath, '-C', install_path, '--strip-components 1'], {
90+
var install_instance = spawn('tar', ['zxf', module_filepath, '-C', install_path, '--strip-components', '1'], {
9291
stdio : 'inherit',
93-
env: process.env,
94-
shell : true
92+
env: process.env
9593
})
9694

9795
install_instance.on('close', function(code) {
@@ -254,10 +252,9 @@ function uninstall(PM2, module_name, cb) {
254252
function getModuleName(module_filepath, cb) {
255253
var tmp_folder = path.join(os.tmpdir(), cst.MODULE_BASEFOLDER)
256254

257-
var install_instance = spawn('tar', ['zxf', module_filepath, '-C', os.tmpdir(), `${cst.MODULE_BASEFOLDER}/package.json`], {
255+
var install_instance = spawn('tar', ['zxf', module_filepath, '-C', os.tmpdir(), cst.MODULE_BASEFOLDER + '/package.json'], {
258256
stdio : 'inherit',
259-
env: process.env,
260-
shell : true
257+
env: process.env
261258
})
262259

263260
install_instance.on('close', function(code) {

lib/binaries/CLI.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,15 +504,15 @@ commander.command('install <module|git:// url>')
504504
.option('--safe [time]', 'keep module backup, if new module fail = restore with previous')
505505
.description('install or update a module and run it forever')
506506
.action(function(plugin_name, opts) {
507-
require('util')._extend(commander, opts);
507+
Object.assign(commander, opts);
508508
pm2.install(plugin_name, commander);
509509
});
510510

511511
commander.command('module:update <module|git:// url>')
512512
.option('--tarball', 'is local tarball')
513513
.description('update a module and run it forever')
514514
.action(function(plugin_name, opts) {
515-
require('util')._extend(commander, opts);
515+
Object.assign(commander, opts);
516516
pm2.install(plugin_name, commander);
517517
});
518518

0 commit comments

Comments
 (0)