lavasys - System plugin for mumu language
A system and process plugin for the MuMu interpreter/Lava runtime. This crate works with Linux, Mac, and Windows.
Features:
-
sys:command(cmdString, callback): runs a command in a subshell, calls back to lava and passes results to the callback. -
sys:timestamp_ms()` : returns unix time in milliseconds. -
sys:timestamp_micro(): returns unix time in microseconds. -
Includes background task management for commands.
Usage
Load the plugin with extend:
extend("sys")
Dynamic functions:
// Run a command:
sys:command("ls", func (res) { printlin(res) })
// Get milliseconds since UNIX_EPOCH for time: sys:timestamp_ms()
// Get microseconds since UNIX_EPOCH for time: sys:timestamp_micro()
The callback for sys.command receives a keyed array with these keys:
- "command": String, the command executed in shell
- "stdout": String, stdout from the command
- "stderr": String, STDOUT from the command
- "exit": Int, exit code
- "success": Bool, true if exit code = 0
Installation
Build the package:
make
Install the library:
make install
Contributing
- Pull requests welcomed
License
MuMu and Lava are licensed under MIT and Apache License.