Skip to content

Commit 324b567

Browse files
committed
docs(spawn): document windowsVerbatimArguments option
Add documentation for the windowsVerbatimArguments option that's supported by @npmcli/promise-spawn but was previously undocumented in our wrapper. This option disables argument quoting/escaping on Windows when shell: true is used, allowing exact control over argument formatting. Useful for advanced shell command scenarios on Windows. Also sorted JSDoc @Property declarations alphabetically for consistency.
1 parent 36cb932 commit 324b567

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/spawn.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ function getChildProcess() {
7070
* Options for spawning a child process with promise-based completion.
7171
*
7272
* @property {string | undefined} cwd - Current working directory for the process
73-
* @property {boolean | undefined} stdioString - Convert stdio output to strings (default: `true`)
74-
* @property {StdioType | undefined} stdio - Stdio configuration (`'pipe'`, `'ignore'`, `'inherit'`, or array)
7573
* @property {NodeJS.ProcessEnv | undefined} env - Environment variables for the process
74+
* @property {number | undefined} gid - Group identity of the process (POSIX only)
7675
* @property {boolean | string | undefined} shell - Whether to run command in shell, or path to shell
7776
* @property {AbortSignal | undefined} signal - Signal to abort the process
77+
* @property {StdioType | undefined} stdio - Stdio configuration (`'pipe'`, `'ignore'`, `'inherit'`, or array)
78+
* @property {boolean | undefined} stdioString - Convert stdio output to strings (default: `true`)
7879
* @property {number | undefined} timeout - Maximum time in milliseconds before killing the process
7980
* @property {number | undefined} uid - User identity of the process (POSIX only)
80-
* @property {number | undefined} gid - Group identity of the process (POSIX only)
81+
* @property {boolean | undefined} windowsVerbatimArguments - Don't quote or escape arguments on Windows (requires shell: true). Use when you need exact argument control. Default: false
8182
*/
8283
export type PromiseSpawnOptions = {
8384
cwd?: string | undefined
@@ -89,6 +90,7 @@ export type PromiseSpawnOptions = {
8990
stdioString?: boolean | undefined
9091
timeout?: number | undefined
9192
uid?: number | undefined
93+
windowsVerbatimArguments?: boolean | undefined
9294
}
9395

9496
/**
@@ -413,17 +415,18 @@ interface WritableStreamType {
413415
* Options for spawning a child process with {@link spawn}.
414416
* Extends Node.js spawn options with additional Socket-specific functionality.
415417
*
416-
* @property {import('./spinner').Spinner | undefined} spinner - Spinner instance to pause during execution
417-
* @property {boolean | undefined} stdioString - Convert output to strings (default: `true`)
418-
* @property {boolean | undefined} stripAnsi - Remove ANSI codes from output (default: `true`)
419418
* @property {string | URL | undefined} cwd - Current working directory
420419
* @property {NodeJS.ProcessEnv | undefined} env - Environment variables
421-
* @property {StdioType | undefined} stdio - Stdio configuration
420+
* @property {number | undefined} gid - Group identity (POSIX)
422421
* @property {boolean | string | undefined} shell - Run command in shell
423-
* @property {number | undefined} timeout - Timeout in milliseconds
424422
* @property {AbortSignal | undefined} signal - Abort signal
423+
* @property {import('./spinner').Spinner | undefined} spinner - Spinner instance to pause during execution
424+
* @property {StdioType | undefined} stdio - Stdio configuration
425+
* @property {boolean | undefined} stdioString - Convert output to strings (default: `true`)
426+
* @property {boolean | undefined} stripAnsi - Remove ANSI codes from output (default: `true`)
427+
* @property {number | undefined} timeout - Timeout in milliseconds
425428
* @property {number | undefined} uid - User identity (POSIX)
426-
* @property {number | undefined} gid - Group identity (POSIX)
429+
* @property {boolean | undefined} windowsVerbatimArguments - Don't quote or escape arguments on Windows (requires shell: true). Use when you need exact argument control. Default: false
427430
*/
428431
export type SpawnOptions = import('./objects').Remap<
429432
NodeSpawnOptions & {
@@ -607,6 +610,7 @@ export function spawn(
607610
stdio: spawnOptions.stdio,
608611
stdioString,
609612
shell: spawnOptions.shell,
613+
windowsVerbatimArguments: spawnOptions.windowsVerbatimArguments,
610614
timeout: spawnOptions.timeout,
611615
uid: spawnOptions.uid,
612616
gid: spawnOptions.gid,

0 commit comments

Comments
 (0)