System

From Reia

Jump to: navigation, search

System exposes various interfacing routines for working with the external environment.

System.args()

This is used to retrieve arguments passed to the Reia interpreter. The arguments are returned as a list of strings.

Consider the example script:

puts(System.args().inspect())

If executed with:

reia example.re --foo bar --baz

it will print out:

["--foo","bar","--baz"]

System.args() even works with ire:

~$ ire 1 2 3
Reia Interactive Shell (prerelease)
Running on Erlang (BEAM) emulator version 5.6.5 [source] [smp:2] [async-threads:0] [hipe] [kernel-poll:true]

>> System.args()
=> ["1","2","3"]

System.cpus()

This returns the number of CPUs visible to Reia (i.e. the Erlang virtual machine)

>> System.cpus()
=> 4

System.halt()

This terminates the virtual machine, with an optional error code

Personal tools