workflow_node/node_sys/interface/
process.rs1use crate::node_sys::{
2 class::{EventEmitter, stream},
3 interface::{
4 CpuUsage, Domain, HrTime, MemoryUsage, NodeModule, ProcessFeatures, ProcessRelease,
5 ProcessSendOptions, ProcessVersions,
6 },
7};
8use js_sys::{Function, JsString, Number, Object, Set};
9use wasm_bindgen::prelude::*;
10
11#[wasm_bindgen]
12extern "C" {
13 #[wasm_bindgen(extends = EventEmitter)]
14 #[derive(Clone, Debug)]
15 pub type Process;
16
17 #[wasm_bindgen(method, catch)]
22 pub fn abort(this: &Process) -> Result<(), JsValue>;
23
24 #[wasm_bindgen(method)]
25 pub fn chdir(this: &Process, directory: JsString);
26
27 #[wasm_bindgen(method)]
29 pub fn config(this: &Process) -> Object;
30
31 #[wasm_bindgen(method, js_name = "cpuUsage")]
32 pub fn cpu_usage(this: &Process, previous_value: Option<&CpuUsage>) -> CpuUsage;
33
34 #[wasm_bindgen(method)]
35 pub fn cwd(this: &Process) -> JsString;
36
37 #[wasm_bindgen(method)]
38 pub fn disconnect(this: &Process);
39
40 #[wasm_bindgen(method, js_name = "emitWarning")]
41 pub fn emit_warning(
42 this: &Process,
43 warning: &JsString,
44 name: Option<&JsString>,
45 ctor: Option<&Function>,
46 );
47
48 #[wasm_bindgen(method)]
49 pub fn exit(this: &Process);
50
51 #[wasm_bindgen(method, js_name = "getegid")]
52 pub fn get_egid(this: &Process) -> i32;
53
54 #[wasm_bindgen(method, js_name = "geteuid")]
55 pub fn get_euid(this: &Process) -> i32;
56
57 #[wasm_bindgen(method, js_name = "getgid")]
58 pub fn get_gid(this: &Process) -> i32;
59
60 #[wasm_bindgen(method, js_name = "getgroups")]
61 pub fn get_groups(this: &Process) -> Box<[JsValue]>;
62
63 #[wasm_bindgen(method, js_name = "getuid")]
64 pub fn get_uid(this: &Process) -> i32;
65
66 #[wasm_bindgen(method, catch)]
67 pub fn kill(this: &Process, pid: u32) -> Result<(), JsValue>;
68
69 #[wasm_bindgen(method, catch, js_name = "kill")]
70 pub fn kill_with_signal_name(
71 this: &Process,
72 pid: u32,
73 signal_name: &JsString,
74 ) -> Result<(), JsValue>;
75
76 #[wasm_bindgen(method, catch, js_name = "kill")]
77 pub fn kill_with_signal_id(this: &Process, pid: u32, signal_id: i32) -> Result<(), JsValue>;
78
79 #[wasm_bindgen(method, js_name = "memoryUsage")]
80 pub fn memory_usage(this: &Process) -> MemoryUsage;
81
82 #[wasm_bindgen(method, variadic, js_name = "nextTick")]
83 pub fn next_tick(this: &Process, callback: &Function, args: Box<[JsValue]>);
84
85 #[wasm_bindgen(method, js_name = "resourceUsage")]
87 pub fn resource_usage(this: &Process) -> Object;
88
89 #[wasm_bindgen(method)]
91 pub fn send(
92 this: &Process,
93 message: &JsValue,
94 send_handle: Option<&Object>,
95 options: Option<ProcessSendOptions>,
96 callback: Option<&Function>,
97 ) -> bool;
98
99 #[wasm_bindgen(method, catch, js_name = "setegid")]
100 pub fn set_egid(this: &Process, id: u32) -> Result<(), JsValue>;
101
102 #[wasm_bindgen(method, catch, js_name = "seteuid")]
103 pub fn set_euid(this: &Process, id: u32) -> Result<(), JsValue>;
104
105 #[wasm_bindgen(method, catch, js_name = "setgid")]
106 pub fn set_gid(this: &Process, id: u32) -> Result<(), JsValue>;
107
108 #[wasm_bindgen(method, catch, js_name = "setuid")]
109 pub fn set_uid(this: &Process, id: u32) -> Result<(), JsValue>;
110
111 #[wasm_bindgen(method, catch, js_name = "setgroups")]
112 pub fn set_groups(this: &Process, id: u32) -> Result<(), JsValue>;
113
114 #[wasm_bindgen(method, js_name = "setUncaughtExceptionCaptureCallback")]
115 pub fn set_uncaught_exception_capture_callback(this: &Process, callback: &Function);
116
117 #[wasm_bindgen(method)]
118 pub fn umask(this: &Process, mask: Option<u32>) -> u32;
119
120 #[wasm_bindgen(method)]
121 pub fn uptime(this: &Process) -> f64;
122
123 #[wasm_bindgen(method, getter, js_name = "allowedNodeEnvironmentFlags")]
128 pub fn allowed_node_environment_flags(this: &Process) -> Set;
129
130 #[wasm_bindgen(method, getter)]
131 pub fn arch(this: &Process) -> JsString;
132
133 #[wasm_bindgen(method, getter)]
134 pub fn argv(this: &Process) -> Box<[JsValue]>;
135
136 #[wasm_bindgen(method, getter)]
137 pub fn argv0(this: &Process) -> JsString;
138
139 #[wasm_bindgen(method, getter)]
141 pub fn connected(this: &Process) -> bool;
142
143 #[wasm_bindgen(method, getter)]
144 pub fn debug_port(this: &Process) -> Number;
145
146 #[wasm_bindgen(method, getter)]
147 pub fn domain(this: &Process) -> Option<Domain>;
148
149 #[wasm_bindgen(method, getter)]
150 pub fn env(this: &Process) -> Object;
151
152 #[wasm_bindgen(method, getter, js_name = "execArgv")]
153 pub fn exec_argv(this: &Process) -> Box<[JsValue]>;
154
155 #[wasm_bindgen(method, getter, js_name = "execPath")]
156 pub fn exec_path(this: &Process) -> JsString;
157
158 #[wasm_bindgen(method, getter, js_name = "exitCode")]
159 pub fn exit_code(this: &Process) -> Option<i32>;
160
161 #[wasm_bindgen(method, getter)]
162 pub fn features(this: &Process) -> ProcessFeatures;
163
164 #[wasm_bindgen(method, getter, js_name = "hrtime")]
165 pub fn hr_time(this: &Process) -> HrTime;
166
167 #[wasm_bindgen(method, getter, js_name = "mainModule")]
168 pub fn main_module(this: &Process) -> Option<NodeModule>;
169
170 #[wasm_bindgen(method, getter, js_name = "noDeprecation")]
171 pub fn no_deprecation(this: &Process) -> bool;
172
173 #[wasm_bindgen(method, getter)]
174 pub fn pid(this: &Process) -> JsString;
175
176 #[wasm_bindgen(method, getter)]
177 pub fn platform(this: &Process) -> JsString;
178
179 #[wasm_bindgen(method, getter)]
180 pub fn ppid(this: &Process) -> JsString;
181
182 #[wasm_bindgen(method, getter)]
183 pub fn release(this: &Process) -> ProcessRelease;
184
185 #[wasm_bindgen(method, getter)]
187 pub fn report(this: &Process) -> Object;
188
189 #[wasm_bindgen(method, getter)]
190 pub fn stderr(this: &Process) -> stream::Writable;
191
192 #[wasm_bindgen(method, getter)]
193 pub fn stdin(this: &Process) -> stream::Readable;
194
195 #[wasm_bindgen(method, getter)]
196 pub fn stdout(this: &Process) -> stream::Writable;
197
198 #[wasm_bindgen(method, getter, js_name = "throwDeprecation")]
199 pub fn throw_deprecation(this: &Process) -> bool;
200
201 #[wasm_bindgen(method, getter)]
202 pub fn title(this: &Process) -> JsString;
203
204 #[wasm_bindgen(method, getter, js_name = "traceDeprecation")]
205 pub fn trace_deprecation(this: &Process) -> bool;
206
207 #[wasm_bindgen(method, getter)]
208 pub fn version(this: &Process) -> JsString;
209
210 #[wasm_bindgen(method, getter)]
211 pub fn versions(this: &Process) -> ProcessVersions;
212}