(html (head (title "sph-lib (sph process)") (link (@ (rel "stylesheet") (type "text/css") (href "/css/sph.css"))) (meta (@ (name "viewport") (content "width=device-width,initial-scale=1"))) #f) (body () (div (@ (class top)) (nav (a (@ (href "/")) "start") ", " (a (@ (href "/feed.xml")) "feed")) "") (div (@ (class "middle")) (div (@ (class mtime) (title "last modification time of the current page")) "2023-04-05") (section (h1 "(sph process)") (div (p "execute programs and evaluate shell or scheme code") (p "part of " (a (@ (href "../../sph-lib.html")) "sph-lib")) (#f (section (@ (class "library-name")) (h1 "module name") (p "(sph process)")) (section (@ (class "library-exports")) (h1 "exported bindings") (div (div (@ (class "doc-bindings")) (div (@ (id "doc-b-" "call-with-working-directory") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "call-with-working-directory") " " (span (@ (class "first-sig")) "path p ->")) "" "") (div (@ (id "doc-b-" "execute") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute") " " (span (@ (class "first-sig")) "a ... ->")) "" "") (div (@ (id "doc-b-" "execute->file") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute->file") " " (span (@ (class "first-sig")) "target-path command command-arguments ... ->")) (div (@ (class "rest-sig")) (div "string (string ...) string ->")) (div (@ (class "description")) (("apply \\\"system*\\\" with command and command-arguments and set standard-output to a file at target-path. the file is either created or overwritten")))) (div (@ (id "doc-b-" "execute->port") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute->port") " " (span (@ (class "first-sig")) "port path arguments ... ->")) (div (@ (class "rest-sig")) (div "port string string ... ->")) (div (@ (class "description")) (("execute program at \\\"path\\\" with \\\"arguments\\\" and write everything that is written to standard output by the program to \\\"port\\\"")))) (div (@ (id "doc-b-" "execute->string") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute->string") " " (span (@ (class "first-sig")) "command command-arguments ... ->")) (div (@ (class "rest-sig")) (div "string (string ...) string ->")) (div (@ (class "description")) (("apply \\\"system*\\\" with command and command-arguments and result in a string for the output the program wrote to standard output")))) (div (@ (id "doc-b-" "execute-and") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute-and") " " (span (@ (class "first-sig")) "a rest ... ->")) (div (@ (class "rest-sig")) (div "(string ...) ... -> system*-result")) (div (@ (class "description")) (("takes lists of arguments to system* and calls system* for each of these arguments." (br) "if one call returns with a non-zero exit value the processing stops and returns the result of system*")))) (div (@ (id "doc-b-" "execute-and-check-result") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute-and-check-result") " " (span (@ (class "first-sig")) "path arguments ... ->")) (div (@ (class "rest-sig")) (div "string (string ...) -> boolean")) (div (@ (class "description")) (("execute command with system*, check exit-status and return true if it is zero, false otherwise.")))) (div (@ (id "doc-b-" "execute-with-pipe") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "execute-with-pipe") " " (span (@ (class "first-sig")) "proc mode path arguments ... ->")) (div (@ (class "rest-sig")) (div "procedure integer string list -> any")) (div (@ (class "description")) (("execute a program with a pipe connected to its standard-output and/or standard-input and pass it as one port to \\\"proc\\\"." (br) "mode can be one of the guile variables OPEN_READ OPEN_WRITE OPEN_BOTH")))) (div (@ (id "doc-b-" "exit-value-zero?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "exit-value-zero?") " " (span (@ (class "first-sig")) "system-result ->")) "" "") (div (@ (id "doc-b-" "process-eval") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-eval") " " (span (@ (class "first-sig")) "code proc ->")) (div (@ (class "rest-sig")) (div "(scheme-expression ...) procedure:{process-output-port -> any} -> any")) (div (@ (class "description")) (("evaluate code in a new guile process, independent from the current process (no shared environment)" (br) "and pass a port for the standard output of the process to proc")))) (div (@ (id "doc-b-" "process-finish") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-finish") " " (span (@ (class "first-sig")) "pid ->")) (div (@ (class "rest-sig")) (div "integer -> boolean")) (div (@ (class "description")) (("use waitpid without extra options and return the exit status integer." (br) "waitpid waits for the termination of the process and afterwards frees the resources of the child process" (br) "which prevents it from staying in zombie status")))) (div (@ (id "doc-b-" "process-finish-success?") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-finish-success?") " " (span (@ (class "first-sig")) "pid ->")) "" "") (div (@ (id "doc-b-" "process-replace") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-replace") " " (span (@ (class "first-sig")) "program-path arguments ... ->")) "" (div (@ (class "description")) (("replaces the current process image with the execution of the program at program-path." (br) "executes programs conventionally with program-path as the first argument." (br) "uses execl")))) (div (@ (id "doc-b-" "process-replace-e") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-replace-e") " " (span (@ (class "first-sig")) "env path arguments ... ->")) (div (@ (class "rest-sig")) (div "(string:\"name=value\" ...) string string ... ->")) (div (@ (class "description")) (("like process-replace but the environment variables of the process are passed with the env parameter." (br) "to use the current environment variables the (environ) procedure can be used - it creates output in the expected format for \\\"env\\\"." (br) "uses execle")))) (div (@ (id "doc-b-" "process-replace-p") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-replace-p") " " (span (@ (class "first-sig")) "program-name/path arguments ... ->")) "" (div (@ (class "description")) (("like process-replace-without-search except that if the path to the program to execute does not start with a slash" (br) "it is searched in the directories in the PATH environment variable." (br) "uses execlp")))) (div (@ (id "doc-b-" "process-replace-pe") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "process-replace-pe") " " (span (@ (class "first-sig")) "env name/path arguments ... ->")) (div (@ (class "rest-sig")) (div "(string:\"name=value\" ...) string string ... ->")) (div (@ (class "description")) (("like process-replace-e except that if the path to the program to execute does not start with a slash" (br) "it is searched in the directories in the PATH environment variable")))) (div (@ (id "doc-b-" "shell-eval") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "shell-eval") " " (span (@ (class "first-sig")) "[a] ->")) "" "") (div (@ (id "doc-b-" "shell-eval->string") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "shell-eval->string") " " (span (@ (class "first-sig")) "command-str ->")) (div (@ (class "rest-sig")) (div "string -> string")) (div (@ (class "description")) (("evaluate command-string with sh and return the resulting string")))) (div (@ (id "doc-b-" "shell-eval-and-check-result") (class "doc-b")) (div (span (@ (class "type")) "procedure") ": " (span (@ (class "name")) "shell-eval-and-check-result") " " (span (@ (class "first-sig")) "command-str ->")) (div (@ (class "rest-sig")) (div "string -> boolean")) (div (@ (class "description")) (("execute command with system, check exit-status and return true if it is zero, false otherwise.")))) (div (@ (id "doc-b-" "sph-process-description") (class "doc-b")) (div (span (@ (class "type")) "variable") ": " (span (@ (class "name")) "sph-process-description")) "" "")))))))) ()))