Operating system operations
Executing an external program
This is achieved through Pliant 'execute' instruction:
The standard for Unix programs is to return zero if everything when fine, nonzero elsewhere.
Under Linux, 'execute' instruction accepts many options:
execute "make bzImage" root "file:/logical/test/" path "file:/logical/test/usr/src/linux/"
'root' option enables to set Unix chrooting jailing,
execute "rm /tmp/foo" user 1001 group 2000
'user' enables to set the Unix user ID,
execute "telnet" input "file:/tmp/input.txt" output "file:/tmp/output.txt" error "file:/tmp/error.txt"
'input' enables to redirect the Unix standard input (file handle 0),
execute "make bzImage" output "file:/tmp/output.txt" mixed
The Unix error file will be the same as the output file.
execute "make bzImage" output "file:/tmp/output.txt" quiet
The Unix error file will be discarded.
execute "make bzImage" quiet
The Unix output and error files will be discarded since no 'ouput' option has been provided.
var Str env := ""
Enables to set the Unix environment provided to the program. Please notice that all variables are provided in a single Pliant string, and that each environment variable setting, including the last one, is followed by a character zero.
execute "make bzImage" detached id (var Str pid)
'detached' option specifies that the program will be executed asynchronously from the current thread, so execution if the current thread will resume immediately. In such a situation, the fact that execute function returns zero does not mean that the executed program ended fine, but only that the program started fine.
Please notice that 'execute' is currently not implemented under Windows. Contributions are welcome.