Modules | @vltpkg/promise-spawn
Classes
SpawnPromise<O, T>
Subtype of Promise returned by promiseSpawn.
Resolution value is inferred from the provided options.
Extends
Promise
<SpawnResultByOptions
<O
> &T
>
Type Parameters
• O extends PromiseSpawnOptions
• T extends object
= object
Constructors
new SpawnPromise()
Parameters
• command: string
• args: string
[]
• opts: O
• extra: T
= ...
Returns
SpawnPromise
<O
, T
>
Overrides
Promise<SpawnResultByOptions<O> & T>.constructor
Defined in
src/promise-spawn/src/index.ts:234
Properties
[toStringTag]
Overrides
Promise.[toStringTag]
Defined in
src/promise-spawn/src/index.ts:218
process
The spawned process this promise references
Defined in
src/promise-spawn/src/index.ts:221
stdin
Expose the child process stdin, if available
Defined in
src/promise-spawn/src/index.ts:224
Accessors
[species]
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]
Defined in
src/promise-spawn/src/index.ts:230
Methods
catch()
Attaches a callback for only the rejection of the Promise.
Type Parameters
• TResult = never
Parameters
• onrejected?: null
| (reason
) => TResult
| PromiseLike
<TResult
>
The callback to execute when the Promise is rejected.
Returns
Promise
<SpawnResult
& object
& T
| TResult
>
A Promise for the completion of the callback.
Inherited from
Promise.catch
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1557
finally()
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Parameters
• onfinally?: null
| () => void
The callback to execute when the Promise is settled (fulfilled or rejected).
Returns
Promise
<SpawnResult
& object
& T
>
A Promise for the completion of the callback.
Inherited from
Promise.finally
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2018.promise.d.ts:29
then()
Attaches callbacks for the resolution and/or rejection of the Promise.
Type Parameters
• TResult1 = SpawnResult
& object
& T
• TResult2 = never
Parameters
• onfulfilled?: null
| (value
) => TResult1
| PromiseLike
<TResult1
>
The callback to execute when the Promise is resolved.
• onrejected?: null
| (reason
) => TResult2
| PromiseLike
<TResult2
>
The callback to execute when the Promise is rejected.
Returns
Promise
<TResult1
| TResult2
>
A Promise for the completion of which ever callback is executed.
Inherited from
Promise.then
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1550
all()
all(values)
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
Type Parameters
• T
Parameters
• values: Iterable
<T
| PromiseLike
<T
>>
An iterable of Promises.
Returns
Promise
<Awaited
<T
>[]>
A new Promise.
Inherited from
Promise.all
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:225
all(values)
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
Type Parameters
• T extends [] | readonly unknown
[]
Parameters
• values: T
An array of Promises.
Returns
Promise
<{ -readonly [P in string | number | symbol]: Awaited<T[P<P>]> }>
A new Promise.
Inherited from
Promise.all
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.promise.d.ts:39
allSettled()
allSettled(values)
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
Type Parameters
• T extends [] | readonly unknown
[]
Parameters
• values: T
An array of Promises.
Returns
Promise
<{ -readonly [P in string | number | symbol]: PromiseSettledResult<Awaited<T[P<P>]>> }>
A new Promise.
Inherited from
Promise.allSettled
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2020.promise.d.ts:38
allSettled(values)
Creates a Promise that is resolved with an array of results when all of the provided Promises resolve or reject.
Type Parameters
• T
Parameters
• values: Iterable
<T
| PromiseLike
<T
>>
An array of Promises.
Returns
Promise
<PromiseSettledResult
<Awaited
<T
>>[]>
A new Promise.
Inherited from
Promise.allSettled
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2020.promise.d.ts:46
any()
any(values)
The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
Type Parameters
• T extends [] | readonly unknown
[]
Parameters
• values: T
An array or iterable of Promises.
Returns
Promise
<Awaited
<T
[number
]>>
A new Promise.
Inherited from
Promise.any
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2021.promise.d.ts:40
any(values)
The any function returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError containing an array of rejection reasons if all of the given promises are rejected. It resolves all elements of the passed iterable to promises as it runs this algorithm.
Type Parameters
• T
Parameters
• values: Iterable
<T
| PromiseLike
<T
>>
An array or iterable of Promises.
Returns
Promise
<Awaited
<T
>>
A new Promise.
Inherited from
Promise.any
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2021.promise.d.ts:47
race()
race(values)
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
Type Parameters
• T
Parameters
• values: Iterable
<T
| PromiseLike
<T
>>
An iterable of Promises.
Returns
Promise
<Awaited
<T
>>
A new Promise.
Inherited from
Promise.race
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.iterable.d.ts:233
race(values)
Creates a Promise that is resolved or rejected when any of the provided Promises are resolved or rejected.
Type Parameters
• T extends [] | readonly unknown
[]
Parameters
• values: T
An array of Promises.
Returns
Promise
<Awaited
<T
[number
]>>
A new Promise.
Inherited from
Promise.race
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.promise.d.ts:50
reject()
Creates a new rejected promise for the provided reason.
Type Parameters
• T = never
Parameters
• reason?: any
The reason the promise was rejected.
Returns
Promise
<T
>
A new rejected Promise.
Inherited from
Promise.reject
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.promise.d.ts:60
resolve()
resolve(undefined)
Creates a new resolved promise.
Returns
Promise
<void
>
A resolved promise.
Inherited from
Promise.resolve
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.promise.d.ts:66
resolve(value)
Creates a new resolved promise for the provided value.
Type Parameters
• T
Parameters
• value: T
A promise.
Returns
Promise
<Awaited
<T
>>
A promise whose internal state matches the provided promise.
Inherited from
Promise.resolve
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.promise.d.ts:72
resolve(value)
Creates a new resolved promise for the provided value.
Type Parameters
• T
Parameters
• value: T
| PromiseLike
<T
>
A promise.
Returns
Promise
<Awaited
<T
>>
A promise whose internal state matches the provided promise.
Inherited from
Promise.resolve
Defined in
node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2015.promise.d.ts:78
Type Aliases
ChildProcessByOptions<T>
Type declaration
stderr
stdin
stdout
Type Parameters
• T extends PromiseSpawnOptions
Defined in
src/promise-spawn/src/index.ts:199
IOTypeNoPipe
Defined in
src/promise-spawn/src/index.ts:20
IOTypePipe
Defined in
src/promise-spawn/src/index.ts:21
PromiseSpawnOptions
Type declaration
acceptFail?
stdioString?
Defined in
src/promise-spawn/src/index.ts:22
PromiseSpawnOptionsBuffer
Type declaration
stdioString
Defined in
src/promise-spawn/src/index.ts:29
PromiseSpawnOptionsNoStderr
Type declaration
stdio
Defined in
src/promise-spawn/src/index.ts:97
PromiseSpawnOptionsNoStdin
Type declaration
stdio
Defined in
src/promise-spawn/src/index.ts:41
PromiseSpawnOptionsNoStdout
Type declaration
stdio
Defined in
src/promise-spawn/src/index.ts:68
PromiseSpawnOptionsStderr
Type declaration
stdio?
Defined in
src/promise-spawn/src/index.ts:79
PromiseSpawnOptionsStderrBuffer
Type declaration
stdioString
Defined in
src/promise-spawn/src/index.ts:93
PromiseSpawnOptionsStderrString
Type declaration
stdioString?
Defined in
src/promise-spawn/src/index.ts:89
PromiseSpawnOptionsStdin
Type declaration
stdio?
Defined in
src/promise-spawn/src/index.ts:32
PromiseSpawnOptionsStdout
Type declaration
stdio?
Defined in
src/promise-spawn/src/index.ts:51
PromiseSpawnOptionsStdoutBuffer
Type declaration
stdioString
Defined in
src/promise-spawn/src/index.ts:64
PromiseSpawnOptionsStdoutString
Type declaration
stdioString?
Defined in
src/promise-spawn/src/index.ts:60
PromiseSpawnOptionsString
Type declaration
stdioString?
Defined in
src/promise-spawn/src/index.ts:26
SpawnResult
Type declaration
args
command
cwd
signal
status
stderr
stdout
Defined in
src/promise-spawn/src/index.ts:128
SpawnResultBuffer
Type declaration
stderr
stdout
Defined in
src/promise-spawn/src/index.ts:141
SpawnResultByOptions<T>
Type declaration
stderr
stdout
Type Parameters
• T extends PromiseSpawnOptions
Defined in
src/promise-spawn/src/index.ts:183
SpawnResultNoStderr
Type declaration
stderr
Defined in
src/promise-spawn/src/index.ts:166
SpawnResultNoStdio
Type declaration
stderr
stdout
Defined in
src/promise-spawn/src/index.ts:170
SpawnResultNoStdout
Type declaration
stdout
Defined in
src/promise-spawn/src/index.ts:154
SpawnResultStderr
Type declaration
stderr
Defined in
src/promise-spawn/src/index.ts:157
SpawnResultStderrBuffer
Type declaration
stderr
Defined in
src/promise-spawn/src/index.ts:163
SpawnResultStderrString
Type declaration
stderr
Defined in
src/promise-spawn/src/index.ts:160
SpawnResultStdioBuffers
Type declaration
stderr
stdout
Defined in
src/promise-spawn/src/index.ts:178
SpawnResultStdioStrings
Type declaration
stderr
stdout
Defined in
src/promise-spawn/src/index.ts:174
SpawnResultStdout
Type declaration
stdout
Defined in
src/promise-spawn/src/index.ts:145
SpawnResultStdoutBuffer
Type declaration
stdout
Defined in
src/promise-spawn/src/index.ts:151
SpawnResultStdoutString
Type declaration
stdout
Defined in
src/promise-spawn/src/index.ts:148
SpawnResultString
Type declaration
stderr
stdout
Defined in
src/promise-spawn/src/index.ts:137
Functions
promiseSpawn()
Spawn the specified command, and return a promise that resolves when the process closes or has an error.
Type Parameters
• O extends PromiseSpawnOptions
= SpawnOptions
& object
& object
& object
& object
& object
• E extends object
= object
Parameters
• command: string
• args: string
[]
• opts: O
= ...
• extra: E
= ...
Returns
SpawnPromise
<O
, E
>
Defined in
src/promise-spawn/src/index.ts:292