Skip to content

@vltpkg/promise-spawn

Classes

SpawnPromise<O, T>

Defined in: index.ts:216

Subtype of Promise returned by promiseSpawn.

Resolution value is inferred from the provided options.

Extends

Type Parameters

O extends PromiseSpawnOptions

T extends object = object

Constructors

new SpawnPromise()
new SpawnPromise<O, T>(
command,
args,
opts,
extra): SpawnPromise<O, T>

Defined in: index.ts:236

Parameters
command

string

args

string[]

opts

O

extra

T = ...

Returns

SpawnPromise<O, T>

Overrides
Promise<SpawnResultByOptions<O> & T>.constructor

Properties

[toStringTag]
[toStringTag]: string = 'SpawnPromise';

Defined in: index.ts:220

Overrides
Promise.[toStringTag]
process
process: ChildProcessByOptions<O>

Defined in: index.ts:223

The spawned process this promise references

stdin
stdin: O extends PromiseSpawnOptionsNoStdin ? null : Writable;

Defined in: index.ts:226

Expose the child process stdin, if available

Accessors

[species]
Get Signature
get static species: PromiseConstructor

Defined in: index.ts:232

Set static Symbol.species back to the base Promise class so that v8 doesn’t get confused by the changed constructor signature.

Returns

PromiseConstructor

Overrides
Promise.[species]

Interfaces

PromiseSpawnOptions

Defined in: index.ts:23

Extends

  • SpawnOptions

Extended by

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

stdioString?
optional stdioString: boolean;

Defined in: index.ts:24


PromiseSpawnOptionsBuffer

Defined in: index.ts:30

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdioString
stdioString: false

Defined in: index.ts:31

Overrides

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsNoStderr

Defined in: index.ts:92

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdio
stdio:
| IOTypeNoPipe
| IOTypeNoPipe[]
| [number | IOType | "ipc" | Stream | null | undefined, number | IOType | "ipc" | Stream | null | undefined, IOTypeNoPipe];

Defined in: index.ts:93

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Overrides
PromiseSpawnOptions.stdio
stdioString?
optional stdioString: boolean;

Defined in: index.ts:24

Inherited from

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsNoStdin

Defined in: index.ts:42

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdio
stdio:
| IOTypeNoPipe
| IOTypeNoPipe[]
| [number | IOTypeNoPipe, number | IOType | "ipc" | Stream | null | undefined, number | IOType | "ipc" | Stream | null | undefined];

Defined in: index.ts:43

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Overrides
PromiseSpawnOptions.stdio
stdioString?
optional stdioString: boolean;

Defined in: index.ts:24

Inherited from

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsNoStdout

Defined in: index.ts:67

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdio
stdio:
| IOTypeNoPipe
| IOTypeNoPipe[]
| [number | IOType | "ipc" | Stream | null | undefined, IOTypeNoPipe | undefined, number | IOType | "ipc" | Stream | null | undefined];

Defined in: index.ts:68

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Overrides
PromiseSpawnOptions.stdio
stdioString?
optional stdioString: boolean;

Defined in: index.ts:24

Inherited from

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsStderr

Defined in: index.ts:77

Extends

Extended by

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [null | number | IOType | "ipc" | Stream, null | number | IOType | "ipc" | Stream, IOTypePipe];

Defined in: index.ts:78

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Overrides
PromiseSpawnOptions.stdio
stdioString?
optional stdioString: boolean;

Defined in: index.ts:24

Inherited from

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsStderrBuffer

Defined in: index.ts:89

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptionsStderr.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [null | number | IOType | "ipc" | Stream, null | number | IOType | "ipc" | Stream, IOTypePipe];

Defined in: index.ts:78

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Inherited from

PromiseSpawnOptionsStderr.stdio

stdioString
stdioString: false

Defined in: index.ts:90

Overrides

PromiseSpawnOptionsStderr.stdioString


PromiseSpawnOptionsStderrString

Defined in: index.ts:86

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptionsStderr.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [null | number | IOType | "ipc" | Stream, null | number | IOType | "ipc" | Stream, IOTypePipe];

Defined in: index.ts:78

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Inherited from

PromiseSpawnOptionsStderr.stdio

stdioString?
optional stdioString: true;

Defined in: index.ts:87

Overrides

PromiseSpawnOptionsStderr.stdioString


PromiseSpawnOptionsStdin

Defined in: index.ts:33

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [IOTypePipe, null | number | IOType | "ipc" | Stream, null | number | IOType | "ipc" | Stream];

Defined in: index.ts:34

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Overrides
PromiseSpawnOptions.stdio
stdioString?
optional stdioString: boolean;

Defined in: index.ts:24

Inherited from

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsStdout

Defined in: index.ts:52

Extends

Extended by

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [null | number | IOType | "ipc" | Stream, IOTypePipe, null | number | IOType | "ipc" | Stream];

Defined in: index.ts:53

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Overrides
PromiseSpawnOptions.stdio
stdioString?
optional stdioString: boolean;

Defined in: index.ts:24

Inherited from

PromiseSpawnOptions.stdioString


PromiseSpawnOptionsStdoutBuffer

Defined in: index.ts:64

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptionsStdout.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [null | number | IOType | "ipc" | Stream, IOTypePipe, null | number | IOType | "ipc" | Stream];

Defined in: index.ts:53

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Inherited from

PromiseSpawnOptionsStdout.stdio

stdioString
stdioString: false

Defined in: index.ts:65

Overrides

PromiseSpawnOptionsStdout.stdioString


PromiseSpawnOptionsStdoutString

Defined in: index.ts:61

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptionsStdout.acceptFail

stdio?
optional stdio:
| "overlapped"
| "pipe"
| [null | number | IOType | "ipc" | Stream, IOTypePipe, null | number | IOType | "ipc" | Stream];

Defined in: index.ts:53

Can be set to ‘pipe’, ‘inherit’, ‘overlapped’, or ‘ignore’, or an array of these strings. If passed as an array, the first element is used for stdin, the second for stdout, and the third for stderr. A fourth element can be used to specify the stdio behavior beyond the standard streams. See ChildProcess.stdio for more information.

Default
'pipe'
Inherited from

PromiseSpawnOptionsStdout.stdio

stdioString?
optional stdioString: true;

Defined in: index.ts:62

Overrides

PromiseSpawnOptionsStdout.stdioString


PromiseSpawnOptionsString

Defined in: index.ts:27

Extends

Properties

acceptFail?
optional acceptFail: boolean;

Defined in: index.ts:25

Inherited from

PromiseSpawnOptions.acceptFail

stdioString?
optional stdioString: true;

Defined in: index.ts:28

Overrides

PromiseSpawnOptions.stdioString


SpawnResult

Defined in: index.ts:123

Extended by

Properties

args
args: string[];

Defined in: index.ts:125

command
command: string

Defined in: index.ts:124

cwd
cwd: string

Defined in: index.ts:126

signal
signal: null | Signals

Defined in: index.ts:128

status
status: null | number

Defined in: index.ts:127

stderr
stderr: null | string | Buffer<ArrayBufferLike>

Defined in: index.ts:130

stdout
stdout: null | string | Buffer<ArrayBufferLike>

Defined in: index.ts:129


SpawnResultBuffer

Defined in: index.ts:136

Extends

Extended by

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: null | Buffer<ArrayBufferLike>

Defined in: index.ts:138

Overrides

SpawnResult.stderr

stdout
stdout: null | Buffer<ArrayBufferLike>

Defined in: index.ts:137

Overrides

SpawnResult.stdout


SpawnResultNoStderr

Defined in: index.ts:161

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: null

Defined in: index.ts:162

Overrides

SpawnResult.stderr

stdout
stdout: null | string | Buffer<ArrayBufferLike>

Defined in: index.ts:129

Inherited from

SpawnResult.stdout


SpawnResultNoStdio

Defined in: index.ts:164

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: null

Defined in: index.ts:165

Overrides

SpawnResult.stderr

stdout
stdout: null

Defined in: index.ts:166

Overrides

SpawnResult.stdout


SpawnResultNoStdout

Defined in: index.ts:149

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: null | string | Buffer<ArrayBufferLike>

Defined in: index.ts:130

Inherited from

SpawnResult.stderr

stdout
stdout: null

Defined in: index.ts:150

Overrides

SpawnResult.stdout


SpawnResultStderr

Defined in: index.ts:152

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: string | Buffer<ArrayBufferLike>

Defined in: index.ts:153

Overrides

SpawnResult.stderr

stdout
stdout: null | string | Buffer<ArrayBufferLike>

Defined in: index.ts:129

Inherited from

SpawnResult.stdout


SpawnResultStderrBuffer

Defined in: index.ts:158

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResultBuffer.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResultBuffer.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResultBuffer.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResultBuffer.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResultBuffer.status

stderr
stderr: Buffer

Defined in: index.ts:159

Overrides

SpawnResultBuffer.stderr

stdout
stdout: null | Buffer<ArrayBufferLike>

Defined in: index.ts:137

Inherited from

SpawnResultBuffer.stdout


SpawnResultStderrString

Defined in: index.ts:155

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResultString.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResultString.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResultString.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResultString.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResultString.status

stderr
stderr: string

Defined in: index.ts:156

Overrides

SpawnResultString.stderr

stdout
stdout: null | string

Defined in: index.ts:133

Inherited from

SpawnResultString.stdout


SpawnResultStdioBuffers

Defined in: index.ts:172

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: Buffer

Defined in: index.ts:174

Overrides

SpawnResult.stderr

stdout
stdout: Buffer

Defined in: index.ts:173

Overrides

SpawnResult.stdout


SpawnResultStdioStrings

Defined in: index.ts:168

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: string

Defined in: index.ts:170

Overrides

SpawnResult.stderr

stdout
stdout: string

Defined in: index.ts:169

Overrides

SpawnResult.stdout


SpawnResultStdout

Defined in: index.ts:140

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: null | string | Buffer<ArrayBufferLike>

Defined in: index.ts:130

Inherited from

SpawnResult.stderr

stdout
stdout: string | Buffer<ArrayBufferLike>

Defined in: index.ts:141

Overrides

SpawnResult.stdout


SpawnResultStdoutBuffer

Defined in: index.ts:146

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResultBuffer.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResultBuffer.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResultBuffer.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResultBuffer.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResultBuffer.status

stderr
stderr: null | Buffer<ArrayBufferLike>

Defined in: index.ts:138

Inherited from

SpawnResultBuffer.stderr

stdout
stdout: Buffer

Defined in: index.ts:147

Overrides

SpawnResultBuffer.stdout


SpawnResultStdoutString

Defined in: index.ts:143

Extends

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResultString.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResultString.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResultString.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResultString.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResultString.status

stderr
stderr: null | string

Defined in: index.ts:134

Inherited from

SpawnResultString.stderr

stdout
stdout: string

Defined in: index.ts:144

Overrides

SpawnResultString.stdout


SpawnResultString

Defined in: index.ts:132

Extends

Extended by

Properties

args
args: string[];

Defined in: index.ts:125

Inherited from

SpawnResult.args

command
command: string

Defined in: index.ts:124

Inherited from

SpawnResult.command

cwd
cwd: string

Defined in: index.ts:126

Inherited from

SpawnResult.cwd

signal
signal: null | Signals

Defined in: index.ts:128

Inherited from

SpawnResult.signal

status
status: null | number

Defined in: index.ts:127

Inherited from

SpawnResult.status

stderr
stderr: null | string

Defined in: index.ts:134

Overrides

SpawnResult.stderr

stdout
stdout: null | string

Defined in: index.ts:133

Overrides

SpawnResult.stdout

Type Aliases

ChildProcessByOptions<T>

type ChildProcessByOptions<T> = Override<
ChildProcess,
{
stderr: T extends PromiseSpawnOptionsNoStderr ? null
: Exclude<ChildProcess['stderr'], null>
stdin: T extends PromiseSpawnOptionsNoStdin ? null
: Exclude<ChildProcess['stdin'], null>
stdout: T extends PromiseSpawnOptionsNoStdout ? null
: Exclude<ChildProcess['stdout'], null>
}
>

Defined in: index.ts:198

Type Parameters

T extends PromiseSpawnOptions


IOTypeNoPipe

type IOTypeNoPipe = Exclude<IOType, IOTypePipe>

Defined in: index.ts:20


IOTypePipe

type IOTypePipe = 'overlapped' | 'pipe' | null | undefined

Defined in: index.ts:21


Override<T, R>

type Override<T, R> = Omit<T, keyof R> & R

Defined in: index.ts:177

Type Parameters

T

R


SpawnResultByOptions<T>

type SpawnResultByOptions<T> = Override<
SpawnResult,
{
stderr: T extends PromiseSpawnOptionsNoStderr ? null
: T extends PromiseSpawnOptionsStderrBuffer ? Buffer
: T extends PromiseSpawnOptionsStderrString ? string
: T extends PromiseSpawnOptionsBuffer ? Buffer | null
: T extends PromiseSpawnOptionsString ? string | null
: Buffer | string | null
stdout: T extends PromiseSpawnOptionsNoStdout ? null
: T extends PromiseSpawnOptionsStdoutBuffer ? Buffer
: T extends PromiseSpawnOptionsStdoutString ? string
: T extends PromiseSpawnOptionsBuffer ? Buffer | null
: T extends PromiseSpawnOptionsString ? string | null
: Buffer | string | null
}
>

Defined in: index.ts:179

Type Parameters

T extends PromiseSpawnOptions

Functions

promiseSpawn()

function promiseSpawn<O, E>(
command,
args,
opts,
extra,
): SpawnPromise<O, E>

Defined in: index.ts:316

Spawn the specified command, and return a promise that resolves when the process closes or has an error.

Type Parameters

O extends PromiseSpawnOptions = PromiseSpawnOptionsStderrString & PromiseSpawnOptionsStdoutString

E extends object = object

Parameters

command

string

args

string[]

opts

O = ...

extra

E = ...

Returns

SpawnPromise<O, E>