44os Module
44.1Overview
The os
module provides functions that are specific to each OS environment. This is a built-in module, so you can use it without being imported.
44.2Module Function
os.clock() {block?}
Returns the time duration in second since the system has started.
If block
is specified, it would calculate how much time has been spent during evaluating the block.
os.exec(pathname:string, args*:string):map:[fork]
Executes the specified executable file.
os.fromnative(buff:binary):map
Converts binary data that includes OS's native string into Gura's regulated string.
os.getenv(name:string, default?:string):map
Returns the value of an environment variable.
os.putenv(name:string, value:string):void
Set the value of an environment variable.
os.redirect(stdin:stream:nil:r, stdout:stream:nil:w, stderr?:stream:w) {block?}
Modifies variables
os.stdin
, os.stdout
and os.stderr
with values of arguments. When block
is specified, the modification only has effect within the block.
os.sleep(secs:number)
Sleeps for a time specified in seconds.
os.symlink(src:string, tgt:string):map:void
Creates a symbol link.
os.tonative(str:string):map
Converts Gura's regulated string into binary data that includes OS's native string.
os.unsetenv(name:string):void
Unset an environment variable.