Repository navigation
Expand file tree
/
Copy pathindex.d.ts
More file actions
84 lines (82 loc) · 2.71 KB
/
Copy pathindex.d.ts
File metadata and controls
84 lines (82 loc) · 2.71 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
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export const enum Operation {
Modify = 'Modify',
Delete = 'Delete',
}
/**
* Sandboxing rules. Deleting / modifying a path with any of the prefixes is forbidden and will
* cause process termination.
*/
export interface SandboxRule {
/** The forbidden operation. */
operation: Operation;
/** The list of prefixes that are matched by this rule. */
prefixes: Array<string>;
/** The list of prefixes that are excluded from this rule. */
excludePrefixes?: Array<string>;
/** The message to be shown if this rule triggers. */
message: string;
}
/** Options for the sandbox. */
export interface SandboxOptions {
rules: Array<SandboxRule>;
}
/** The options that can be passed to the constructor of Pty. */
export interface PtyOptions {
command: string;
args?: Array<string>;
envs?: Record<string, string>;
dir?: string;
size?: Size;
cgroupPath?: string;
newCgroupNamespace?: boolean;
apparmorProfile?: string;
interactive?: boolean;
/**
* Connect the child's stdout and stderr to one pipe instead of the PTY. The child gets no
* controlling terminal and its stdin is `/dev/null`, so it sees non-terminal output and
* cannot open `/dev/tty`. The controller fd then reads the combined stdout and stderr
* stream. Cannot be combined with `interactive: true`.
*/
pipeOutput?: boolean;
sandbox?: SandboxOptions;
onExit: (err: null | Error, exitCode: number) => void;
}
/** A size struct to pass to resize. */
export interface Size {
cols: number;
rows: number;
}
export const MAX_U16_VALUE: number;
export const MIN_U16_VALUE: number;
export declare function getSyntheticEofSequence(): Buffer;
/** Resize the terminal. */
export declare function ptyResize(fd: number, size: Size): void;
/**
* Set the close-on-exec flag on a file descriptor. This is `fcntl(fd, F_SETFD, FD_CLOEXEC)` under
* the covers.
*/
export declare function setCloseOnExec(fd: number, closeOnExec: boolean): void;
/**
* Get the close-on-exec flag on a file descriptor. This is `fcntl(fd, F_GETFD) & FD_CLOEXEC ==
*_CLOEXEC` under the covers.
*/
export declare function getCloseOnExec(fd: number): boolean;
export declare class Pty {
/** The pid of the forked process. */
pid: number;
constructor(opts: PtyOptions);
/**
* Transfers ownership of the file descriptor for the PTY controller. This can only be called
* once (it will error the second time). The caller is responsible for closing the file
* descriptor.
*/
takeControllerFd(): c_int;
/**
* Closes the owned file descriptor for the PTY controller. The Nodejs side must call this
* when it is done with the file descriptor to avoid leaking FDs.
*/
dropUserFd(): void;
}