os

moon add tonyfettes/os@0.1.1
Download zip
Version
0.1.1
License
Apache-2.0
Last updated
2 months ago
Downloads
382

Dependencies

README

#tonyfettes/os

#
args

fn args() -> Array[String]

Returns the command line arguments passed to the current process.

Implementations:

  • macOS: _NSGetArgc() / _NSGetArgv()
  • Linux: /proc/self/cmdline

#
atexit

fn atexit(f : FuncRef[() -> Unit]) -> Unit

Registers a function to be called when the program exits normally.

The registered function will be executed when the program terminates through normal means (such as returning from main or calling exit()). Functions are called in reverse order of registration (last registered, first called).

Parameters:

  • f : The function to be called at program exit. This function takes no parameters and returns no value.

#
chdir

fn chdir(path : StringView) -> Unit raise

#
cwd

fn cwd() -> String raise

#
executable

fn executable() -> String raise

Returns the path of the current executable. Note that the returned path may be a symbolic link and not the real file, so make sure to resolve it before calling spawn.

Implementations:

  • macOS: _NSGetExecutablePath()
  • Linux: readlink("/proc/self/exe")

#
exit

fn[X] exit(code : Int) -> X

#
getenv

fn getenv(key : StringView) -> String? raise

#
gethostname

fn gethostname() -> String raise

#
home

fn home() -> String raise

#
setenv

fn setenv(key : StringView, value : StringView, overwrite? : Bool) -> Unit raise

#
tmpdir

fn tmpdir() -> String raise

#
unsetenv

fn unsetenv(key : StringView) -> Unit raise

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io