-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.d.ts
76 lines (64 loc) · 1.64 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import EventEmitter, { EventMap } from 'bare-events'
import Buffer from 'bare-buffer'
import Pipe from 'bare-pipe'
import constants from './lib/constants'
import errors from './lib/errors'
export { constants, errors }
export interface SubprocessEvents extends EventMap {
exit: [code: number, signalCode: string]
}
export type IO = 'inherit' | 'pipe' | 'overlapped' | 'ignore'
export interface Subprocess<M extends SubprocessEvents = SubprocessEvents>
extends EventEmitter<M> {
readonly exitCode: number | null
readonly killed: boolean
readonly pid: number
readonly signalCode: string | null
readonly spawnargs: string[]
readonly spawnfile: string
readonly stdio: (Pipe | null)[]
readonly stdin: Pipe | null
readonly stdout: Pipe | null
readonly stderr: Pipe | null
ref(): void
unref(): void
kill(signum?: number): void
}
export class Subprocess {}
export interface SpawnOptions {
cwd?: string
stdio?: [stdin?: IO, stdout?: IO, stderr?: IO, ...fds: IO[]] | IO | null
detached?: boolean
uid?: number
gid?: number
env?: Record<string, string>
}
export function spawn(
file: string,
args?: string[] | null,
opts?: SpawnOptions
): Subprocess
export function spawn(file: string, opts?: SpawnOptions): Subprocess
export function spawnSync(
file: string,
args?: string[] | null,
opts?: SpawnOptions
): {
output: (Buffer | null)[]
pid: number
signal: number
status: number
stderr: Buffer | null
stdout: Buffer | null
}
export function spawnSync(
file: string,
opts?: SpawnOptions
): {
output: (Buffer | null)[]
pid: number
signal: number
status: number
stderr: Buffer | null
stdout: Buffer | null
}