Skip to content

Commit 53216a4

Browse files
committed
fix: fix spawn shell args
1 parent 9d2b0d0 commit 53216a4

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

lib/commands/package/link.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from "node:path";
44
import { readConfig } from "#core/config";
55
import { exists } from "#core/fs";
66
import { glob } from "#core/glob";
7-
import { shellEscape } from "#core/utils";
7+
import { shellQuote } from "#core/utils";
88
import Command from "#lib/command";
99
import Dependencies from "#lib/package/dependencies";
1010

@@ -68,7 +68,7 @@ export default class extends Command {
6868
console.log( "Installing dependencies ..." );
6969
}
7070

71-
const res = childProcess.spawnSync( shellEscape( [ "npm", command ] ), {
71+
const res = childProcess.spawnSync( shellQuote( [ "npm", command ] ), {
7272
"stdio": "inherit",
7373
"shell": true,
7474
} );

lib/package.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import stream from "#core/stream";
1717
import tar from "#core/tar";
1818
import Table from "#core/text/table";
1919
import { TmpDir, TmpFile } from "#core/tmp";
20-
import { confirm, objectIsEmpty, repeatAction, shellEscape } from "#core/utils";
20+
import { confirm, objectIsEmpty, repeatAction, shellQuote } from "#core/utils";
2121
import * as yaml from "#core/yaml";
2222
import Git from "#lib/git";
2323
import lintFile from "#lib/lint/file";
@@ -372,7 +372,7 @@ export default class Package {
372372
// pack package
373373
res = await repeatAction( async () => {
374374
const tmpDir = new TmpDir(),
375-
command = shellEscape( [ "npm", "pack", "--json", "--pack-destination", tmpDir.path, this.root ] );
375+
command = shellQuote( [ "npm", "pack", "--json", "--pack-destination", tmpDir.path, this.root ] );
376376

377377
console.log( "Packing:", command );
378378

@@ -435,7 +435,7 @@ export default class Package {
435435

436436
args.push( pack.path );
437437

438-
const command = shellEscape( args );
438+
const command = shellQuote( args );
439439

440440
res = await repeatAction( async () => {
441441
console.log( "Publishing:", command );
@@ -461,7 +461,7 @@ export default class Package {
461461
// add additional tags
462462
if ( addTags.length ) {
463463
for ( const tag of addTags ) {
464-
const command = shellEscape( [ "npm", "dist-tag", "add", `${ this.name }@${ this.version }`, tag ] );
464+
const command = shellQuote( [ "npm", "dist-tag", "add", `${ this.name }@${ this.version }`, tag ] );
465465

466466
res = await repeatAction( async () => {
467467
console.log( "Adding npm tag:", command );
@@ -628,7 +628,7 @@ export default class Package {
628628
}
629629

630630
runCommand ( command, ...args ) {
631-
const res = childProcess.spawnSync( shellEscape( [ command, ...args ] ), {
631+
const res = childProcess.spawnSync( shellQuote( [ command, ...args ] ), {
632632
"cwd": this.root,
633633
"stdio": "inherit",
634634
"shell": true,
@@ -652,7 +652,7 @@ export default class Package {
652652
argv = [];
653653
}
654654

655-
const res = childProcess.spawnSync( shellEscape( [ "npm", "run", script, ...argv ] ), {
655+
const res = childProcess.spawnSync( shellQuote( [ "npm", "run", script, ...argv ] ), {
656656
"cwd": this.root,
657657
"stdio": "inherit",
658658
"shell": true,

lib/package/release.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import File from "#core/file";
88
import { exists } from "#core/fs";
99
import SemanticVersion from "#core/semantic-version";
1010
import { TmpFile } from "#core/tmp";
11-
import { confirm, repeatAction, shellEscape } from "#core/utils";
11+
import { confirm, repeatAction, shellQuote } from "#core/utils";
1212
import { lintFile } from "#lib/lint";
1313

1414
export default class Publish {
@@ -437,7 +437,7 @@ ${ this.#changelog.linkifyMarkdown( changelogMarkdown ) }
437437

438438
fs.writeFileSync( tmp.path, changelogMarkdown );
439439

440-
const res = childProcess.spawnSync( shellEscape( [ process.env.EDITOR, tmp.path ] ), {
440+
const res = childProcess.spawnSync( shellQuote( [ process.env.EDITOR, tmp.path ] ), {
441441
"shell": true,
442442
"stdio": "inherit",
443443
} );

0 commit comments

Comments
 (0)