Civboot's unix system library
Civix contains standard unix functions that exist in most language's "sys" library such as sleep, epoch etc. It also contains a powerful Sh{} type and convieience sh() function for executing system shell commands, either synchronously or asynchronously using the LAP protocol (see #Package_lap.
$ lua
> sh = require'civix'.sh
> print(sh'ls some/path')
> -- cat /var/log/syslog | grep "netgroup: version"
> out = sh{stdin=io.open'/var/log/syslog', 'grep', 'netgroup: version'}
> for line in require'ds'.lines(out) do ... something per line ... end

Civix depends on the #Package_fd library for async file descriptors and other filedescriptor functionality.

Mod civix

civix: unix-like OS utilities.
Types: B Walk Sh ShFin
Functions

Mod civix.B

Several (but not all) functions in this module are used for civ.lua. However, native modules especially cannot be loaded before the bulid system is bootstrapped (at least not easily), so there are a few of these checks for NOLIB in this library which will use civix.B (bootstrap) instead in that case.
Clients should typically not use civix.B. Functions

Record Walk

Walk the directory tree as a iterator of path, ftype. Can walk either a single path Walk'path/' or a list of paths Walk{'a/', 'b.txt'}. Fields: Methods

Record Sh

Start args on the shell
Suggestion: use civix.sh instead.

Sh:start() kicks off a subprocess which start the shell using the fds you pass in or creating them if you set them to true. Created file descriptors will be stored in the associated name.
Why? This means that :close() will only close filedescriptors created by the shell itself, and you won't accidentially close io.stdout/etc.

Examples (see civix.sh for more examples):
Lua Bash
Sh({'ls', 'foo/bar'}, {stdout=io.stdout}):start() ls foo/bar
v = Sh{'ls foo/bar', stdout=true}:start():read'a' v=$(ls foo/bar)
Fields: Methods

Record ShFin

Fields:

Mod civix.testing

test runners and helpers for civix Functions