package alba

  1. Overview
  2. Docs
Alba compiler

Install

Dune Dependency

Authors

Maintainers

Sources

0.4.2.tar.gz
sha256=203ee151ce793a977b2d3e66f8b3a0cd7a82cc7f15550c63d88cb30c71eb5f95
md5=64367c393f80ca784f88d07155da4fb0

doc/src/alba.fmlib_node/process.ml.html

Source file process.ml

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
open Js_of_ocaml
open Js


class type process =
  object
    method argv: (js_string t) js_array t readonly_prop
    method cwd: js_string t meth
    method exit: int -> 'a meth
    method nextTick: (unit -> unit) callback -> unit meth
  end

let process: process t = Unsafe.eval_string "require('process')"

let next_tick (k:unit -> unit): unit =
  process##nextTick
    (wrap_callback k)

let exit (code:int): 'a  =
  Printf.printf "exiting with code %d\n" code;
  process##exit code

let command_line: string array =
  let arr = to_array process##.argv in
  let len = Array.length arr in
  assert (0 < len);
  Array.map to_string (Array.sub arr 1 (len - 1))

let current_working_directory (_:unit): string =
  to_string process##cwd
OCaml

Innovation. Community. Security.