Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 589ac1f

Browse files
yoursunnyzkochan
andauthored
fix(lifecycle): replace shell-quote with shlex (#9695)
* fix(lifecycle): replace shell-quote with shlex close #9381 * fix: use shlex in @pnpm/worker --------- Co-authored-by: Zoltan Kochan <[email protected]>
1 parent 337a110 commit 589ac1f

File tree

10 files changed

+240
-40
lines changed

10 files changed

+240
-40
lines changed

.changeset/tired-points-brake.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@pnpm/lifecycle": patch
3+
"@pnpm/worker": patch
4+
pnpm: patch
5+
---
6+
7+
Replaced `shell-quote` with `shlex` for quoting command arguments [#9381](https://github.com/pnpm/pnpm/issues/9381).
8+

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
"semistrict",
237237
"serverjs",
238238
"sheetjs",
239+
"shlex",
239240
"sindresorhus",
240241
"sirv",
241242
"soporan",

exec/lifecycle/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"is-windows": "catalog:",
4545
"path-exists": "catalog:",
4646
"run-groups": "catalog:",
47-
"shell-quote": "catalog:"
47+
"shlex": "catalog:"
4848
},
4949
"peerDependencies": {
5050
"@pnpm/logger": "catalog:"
@@ -57,7 +57,6 @@
5757
"@pnpm/test-ipc-server": "workspace:*",
5858
"@types/is-windows": "catalog:",
5959
"@types/rimraf": "catalog:",
60-
"@types/shell-quote": "catalog:",
6160
"@zkochan/rimraf": "catalog:",
6261
"load-json-file": "catalog:"
6362
},

exec/lifecycle/src/runLifecycleHook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { type DependencyManifest, type ProjectManifest, type PrepareExecutionEnv
66
import { PnpmError } from '@pnpm/error'
77
import { existsSync } from 'fs'
88
import isWindows from 'is-windows'
9-
import { quote as shellQuote } from 'shell-quote'
9+
import { join as shellQuote } from 'shlex'
1010

1111
function noop () {} // eslint-disable-line:no-empty
1212

exec/lifecycle/test/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ test('runLifecycleHook() passes newline correctly', async () => {
5555
rawConfig: {},
5656
rootModulesDir,
5757
unsafePerm: true,
58-
args: ['a\nb'],
58+
args: ['a\nb != \'A\\nB\''],
5959
})
6060

6161
expect((await import(path.join(pkgRoot, 'output.json'))).default).toStrictEqual([
62-
process.platform === 'win32' ? 'a\\nb' : 'a\nb',
62+
process.platform === 'win32' ? 'a\\nb != \'A\\\\nB\'' : 'a\nb != \'A\\nB\'',
6363
])
6464
})
6565

0 commit comments

Comments
 (0)