-
Notifications
You must be signed in to change notification settings - Fork 12
/
process.gleam
22 lines (18 loc) · 1016 Bytes
/
process.gleam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gleam/javascript/array.{type Array}
import plinth/javascript/big_int.{type BigInt}
/// Returns an array containing the command-line arguments passed when the Node.js process was launched.
/// The first element will be `process.execPath`.
/// The second element will be the path to the JavaScript file being executed.
/// The remaining elements will be any additional command-line arguments.
@external(javascript, "../../node_process_ffi.mjs", "argv")
pub fn argv() -> Array(String)
/// Returns the current working directory of the Node.js process.
@external(javascript, "process", "cwd")
pub fn cwd() -> String
/// instructs Node.js to terminate the process synchronously with an exit status of `code`.
/// Node.js will not terminate until all the `exit` event listeners are called.
@external(javascript, "process", "exit")
pub fn exit(code code: Int) -> Nil
/// returns the current high-resolution real time in nanoseconds as a bigint
@external(javascript, "process", "hrtime")
pub fn hrtime() -> BigInt