2021-02-05

(sph process)

execute programs and evaluate shell or scheme code

part of sph-lib

module name

(sph process)

exported bindings

procedure: call-with-working-directory path p ->
procedure: execute a ... ->
procedure: execute->file target-path command command-arguments ... ->
string (string ...) string ->
apply \"system*\" with command and command-arguments and set standard-output to a file at target-path. the file is either created or overwritten
procedure: execute->port port path arguments ... ->
port string string ... ->
execute program at \"path\" with \"arguments\" and write everything that is written to standard output by the program to \"port\"
procedure: execute->string command command-arguments ... ->
string (string ...) string ->
apply \"system*\" with command and command-arguments and result in a string for the output the program wrote to standard output
procedure: execute-and a rest ... ->
(string ...) ... -> system*-result
takes lists of arguments to system* and calls system* for each of these arguments.
if one call returns with a non-zero exit value the processing stops and returns the result of system*
procedure: execute-and-check-result path arguments ... ->
string (string ...) -> boolean
execute command with system*, check exit-status and return true if it is zero, false otherwise.
procedure: execute-with-pipe proc mode path arguments ... ->
procedure integer string list -> any
execute a program with a pipe connected to its standard-output and/or standard-input and pass it as one port to \"proc\".
mode can be one of the guile variables OPEN_READ OPEN_WRITE OPEN_BOTH
procedure: exit-value-zero? system-result ->
procedure: process-eval code proc ->
(scheme-expression ...) procedure:{process-output-port -> any} -> any
evaluate code in a new guile process, independent from the current process (no shared environment)
and pass a port for the standard output of the process to proc
procedure: process-finish pid ->
integer -> boolean
use waitpid without extra options and return the exit status integer.
waitpid waits for the termination of the process and afterwards frees the resources of the child process
which prevents it from staying in zombie status
procedure: process-finish-success? pid ->
procedure: process-replace program-path arguments ... ->
replaces the current process image with the execution of the program at program-path.
executes programs conventionally with program-path as the first argument.
uses execl
procedure: process-replace-e env path arguments ... ->
(string:"name=value" ...) string string ... ->
like process-replace but the environment variables of the process are passed with the env parameter.
to use the current environment variables the (environ) procedure can be used - it creates output in the expected format for \"env\".
uses execle
procedure: process-replace-p program-name/path arguments ... ->
like process-replace-without-search except that if the path to the program to execute does not start with a slash
it is searched in the directories in the PATH environment variable.
uses execlp
procedure: process-replace-pe env name/path arguments ... ->
(string:"name=value" ...) string string ... ->
like process-replace-e except that if the path to the program to execute does not start with a slash
it is searched in the directories in the PATH environment variable
procedure: shell-eval [a] ->
procedure: shell-eval->string command-str ->
string -> string
evaluate command-string with sh and return the resulting string
procedure: shell-eval-and-check-result command-str ->
string -> boolean
execute command with system, check exit-status and return true if it is zero, false otherwise.
variable: sph-process-description