The functions in this section can be used to execute shell commands from within Nesl.
shell_command(name, input) {([char], [char]) [char]}
Executes the shell command given by name. If the second argument
is not the empty string, then it is passed to the shell command as standard
input. The shell_command function returns its standard output
as a string. For example, the command shell_command("cat","dog")
would return "dog".
get_environment_variable(name) {[char] [char]}
Gets the value of an environment variable. Will return the empty
string if there is no such variable.
spawn(command, stdin, stdout, stderr)
{([char], stream, stream, stream) ((stream, stream, stream), bool, [char])}
Creates a subprocess (using unix fork). The spawn function
takes 4 arguments:
The function returns three file descriptors a boolean status flag and an error message: ((stdin, stdout, stderr), (flag, message)). For any non null stream passed to spawn, spawn will return the same stream and use that stream as stdin, stdout or stderr. If the null stream is passed for any of the three stream arguments, then spawn will create a new stream and pass back a pointer to it.