(chibi process)

exit

process-command-line

(process-running? pid . o)

(execute cmd args)

Replaces the current process with a new image running the program cmd, with arguments in the list args. The first argument, by convention, should be the file name being executed - an error is signaled if args is null. The command and arguments may be symbols or numbers in addition to strings for convenience. Equivalent to execvp.

(system cmd . args)

Runs the given command cmd in a subprocess, with arguments args. Uses a flat representation of arguments to avoid duplicates, so unlike execute automatically includes cmd as the first argument program name. As a convenience, cmd itself may be a list which is appended to any arguments.

The stdin, stdout and stderr will be inherited from the current process. Use call-with-process-io if you need to capture or manipulate the subprocess IO.

Examples:

(system "date")
Mon Aug 28 23:25:11 JST 2017

(system "ls" "/usr/")
bin  games  include  lib  local  sbin  share  src

(system '(dc -e "2 2 + p"))
4

(system? cmd . args)

Equivalent to system, but returns #t on success and #f on failure.

(call-with-process-io command proc)

Runs the program command in a subprocess and calls proc on 4 arguments: the pid, stdin, stdout and stderr of the subprocess. command should be a list beginning with the program name followed by any args, which may be symbols or numbers for convenience as with system, or a string which is split on white-space.

(process->bytevector command)

Utility to run command and return the accumulated output as a bytevector.

(process->string command)

Utility to run command and return the accumulated output as a string.

(process->sexp command)

Utility to run command and return the accumulated output as a sexp, as from read.

(process->output+error+status command)

Utility to run command and return a list of three values: the accumulated output as a string, the error output as a string, and the exit status as an integer.

(process->output+error command)

Utility to run command and return a list of two values: the accumulated output as a string, the error output as a string.

(process->string-list command)

Utility to run command and return the output as a list of strings, one for each line (trailing newlines not included).An interface to spawning processes and sending and receiving signals between processes.The siginfo_t struct is used to return info about the status, process and user info of a called signal handler.

int: signal/hang-up

int: signal/interrupt

int: signal/quit

int: signal/illegal

int: signal/abort

int: signal/fpe

int: signal/kill

int: signal/segv

int: signal/pipe

int: signal/alarm

int: signal/term

int: signal/user1

int: signal/user2

int: signal/child

int: signal/continue

int: signal/stop

int: signal/tty-stop

int: signal/tty-input

int: signal/tty-output

(set-signal-action! signal handler)

Sets the signal handler for signal to handler and returns the old handler. handler should be a procedure of one argument, the signal number, the value #t for the default signal handler, or #f for no handler. Signal handlers are queued run in a dedicated thread after the system handler has returned.

(signal-set? obj)

The sigset_t struct represents a set of signals for masking.

(make-signal-set sigset_t)

(signal-set-fill! sigset_t)

(signal-set-add! sigset_t int)

(signal-set-delete! sigset_t int)

(signal-set-contains? sigset_t int)

(signal-mask-block! sigset_t sigset_t)

(signal-mask-unblock! sigset_t sigset_t)

(signal-mask-set! sigset_t sigset_t)

(current-signal-mask sigset_t sigset_t)

(alarm unsigned-int)

Send a signal/alarm signal to the current process after unsigned-int seconds have elapsed.

(sleep unsigned-int)

Suspend the current process for unsigned-int seconds. See SRFI-18 thread-sleep! for a light-weight sleep for only the current thread.

(%fork)

Fork the current process. Returns 0 for the newly created process, and the process id of the new process for the parent. If multiple threads are active, they are forked as well. Use fork to also kill all other threads.

(fork)

int: wait/no-hang

(waitpid pid options)

Wait on the process pid, or any child process if pid is -1. options should be 0, or wait/no-hang to return immediately if no processes have reported status. Returns a list whose first element is the actual pid reporting, and the second element is the integer status.

(kill int int)

Send a signal to the given process.Exits the current process immediately. Finalizers are not run.Replace the current process with the given command. Finalizers are not run.

(current-process-id)

Returns the current process id.

(parent-process-id)

Returns the parent process id.