-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
86 lines (69 loc) · 2.3 KB
/
Copy pathindex.d.ts
File metadata and controls
86 lines (69 loc) · 2.3 KB
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
77
78
79
80
81
82
83
84
85
86
import EventEmitter, { EventMap } from 'bare-events'
import Buffer from 'bare-buffer'
import Pipe from 'bare-pipe'
import SubprocessChannel from './lib/channel'
import constants from './lib/constants'
import errors from './lib/errors'
export { constants, errors, type SubprocessChannel }
export interface SubprocessEvents extends EventMap {
exit: [code: number | null, signalCode: string | null]
message: [message: unknown, handle: unknown]
disconnect: []
error: [err: Error]
}
export type IO = 'inherit' | 'pipe' | 'overlapped' | 'ignore' | 'ipc'
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
readonly channel?: SubprocessChannel
readonly connected: boolean
ref(): void
unref(): void
kill(signum?: number): void
send(message: unknown, handle?: unknown, cb?: (err: Error | null) => void): boolean
send(message: unknown, cb: (err: Error | null) => void): boolean
disconnect(): void
}
export class Subprocess {}
export type SerializationMode = 'json' | 'advanced' | 'binary'
export interface SpawnOptions {
cwd?: string
stdio?: [stdin?: IO, stdout?: IO, stderr?: IO, ...fds: IO[]] | IO | null
shell?: boolean | string
detached?: boolean
uid?: number
gid?: number
env?: Record<string, string>
windowsHide?: boolean
windowsVerbatimArguments?: boolean
serialization?: SerializationMode
}
export function spawn(file: string, args?: string[] | null, opts?: SpawnOptions): Subprocess
export function spawn(file: string, opts?: SpawnOptions): Subprocess
export interface SpawnSyncOptions extends SpawnOptions {
input?: string | Buffer
maxBuffer?: number
}
export interface SpawnSyncResult {
output: (Buffer | null)[] | null
pid: number
signal: number
status: number
stdout: Buffer | null
stderr: Buffer | null
error?: Error
}
export function spawnSync(
file: string,
args?: string[] | null,
opts?: SpawnSyncOptions
): SpawnSyncResult
export function spawnSync(file: string, opts?: SpawnSyncOptions): SpawnSyncResult