System-level operations and information


_ <- fat.system


Name Original Type Brief
ExitCode Number Exit status or return code
CommandResult Scope Contains code and out (output)


  • successCode, 0: ExitCode
  • failureCode, 1: ExitCode


Name Signature Brief
args (): List/Text Return list of args passed from shell
exit (code: Number): * Exit program with provided exit code
getEnv (var: Text): Text Get env variable value by name
shell (cmd: Text): ExitCode Execute cmd in shell, return exit code
capture (cmd: Text): CommandResult Capture the output of cmd execution
fork (args: List/Text, out: Text = ø) Start background process, return PID
kill (pid: Number): Void Send SIGTERM to process by PID
getLocale (): Text Get current locale setting
setLocale (cmd: Text): Number Set current locale setting
getMacId (): Text Get machine identifier (MAC address)
setKey (key: Text): Void Set key for obfuscated bundles
setMem (mem: Number): Void Set memory limit (node count)
runGC (): Number Run GC, return elapsed in milliseconds

Usage Notes

Heads Up!

It is important to exercise caution and responsibility when using the getEnv, shell, capture, fork and kill methods. The system library provides the capability to execute commands directly from the operating system, which can introduce security risks if not used carefully.

To mitigate potential vulnerabilities, avoid using user input directly in constructing commands passed to these methods. User input should be validated to prevent command injection attacks and other security breaches.


Use preferably on .fryrc file like so:

_ <- fat.system
setKey('secret')  # will encode and decode bundles with this key

See more about obfuscating.


Use preferably on .fry file like so:

_ <- fat.system
setMem(5000)  # ~2mb

See more about memory management.

get/set locale

The fry interpreter will attempt to initialize LC_ALL locale to C.UTF-8 and if that locale is not available on the system tries to use en_US.UTF-8, otherwise, the default locale will be used.

See more about locale names.

locale configuration applies only to application, and is not persisted after fry exits

results matching ""

    No results matching ""