Sigrid Solveig Haflínudóttirdocs: better grammar68e7d6e2 months agoHistory
113 lines · 4.5 KB · Text
RawDownload
(doc-group process  «External processes.») (defdoc (make-process path args (:in NIL) (:out NIL) (:err NIL) (:dir NIL))  «Run an external program with the specified arguments.    The program is specified by its full path to the executable (`"/bin/ls"`). See   `find-program` for an easy way to locate programs by their name alone.    First element in the list of arguments, by convention, is usually the program's name.    By default, standard input, output, and error streams are assigned to `/dev/null` by   specifying is as `NIL`. To inherit any of the streams from the main (StreetLISP) process   itself, it should be assigned to `T` instead. One can also set it to a string path instead,   in which case for output and error streams the files will be created (or truncated)   automatically. Existing IO objects can be passed as well, if any specific file modes   (like `:append`, see `(help file)`) are needed. A special variant, `:io` is used to create   a pipe - that is useful when dynamic communication with the running process is wanted.   A construct `:err :out` will direct both standard output and error output to the same stream   or IO object.    A `:dir path` will make the program run in the specified directory. Note: any files specified   with `:in`, `:out` and `:err` will be created in the current working directory of the main   process, not the one specified with `:dir`.    By default, the environment of the main process is copied. It can be replaced with   `:env new-env` instead, where the new environment is an association list of key and value   pairs. To start the process with a completely clean environment, `:env NIL` is used.»  :doc-example  «; run ls on /home and make its output available for reading   ; redirect any error output to be visible alongside the REPL   (def p (make-process "/bin/ls" '("ls" "/home") :out :io :err T))   ; ↳ #<process>   (def s (io-read-all (process-output p))) ; read the output as a string»  :doc-group process  :doc-see find-program  :doc-see process-close  :doc-see process-output  :doc-see process?) (defdoc (process-close p)  «Close any streams connected to the process.»  :doc-group process  :doc-see process-post) (defdoc (process-error p)  «Return the standard error stream of the process, or `NIL` if none has been connected.»  :doc-group process  :doc-see process-input  :doc-see process-output) (defdoc (process-input p)  «Return the standard input stream of the process, or `NIL` if none has been connected.»  :doc-group process  :doc-see process-error  :doc-see process-output) (defdoc (process-output p)  «Return the standard output stream of the process, or `NIL` if none has been connected.»  :doc-group process  :doc-see process-input  :doc-see process-error) (defdoc (process-alive? p)  «Return `T` if the process is still alive, or `NIL` otherwise.»  :doc-group process  :doc-see process-state  :doc-see process-core-dumped?) (defdoc (process-core-dumped? p)  «Return `T` if a core image was dumped by the process, or `NIL` otherwise.»  :doc-group process  :doc-see process-alive?) (defdoc (process-state p)  «Return the current state of the process.    The result is either `:running`, `:exited`, `:stopped` or `:signaled`.»  :doc-group process  :doc-see process-alive?  :doc-see process-exit-code  :doc-see process-exit-msg) (defdoc (process? v)  «Return `T` if the argument is a process, `NIL` otherwise.»  :doc-group process  :doc-see make-process) (defdoc (process-exit-code p)  «Return the process' exit status code or `NIL` if the process might still be running.    On Plan 9 this function will always return `0` to indicate normal termination, or `1`   in any other case - see `process-exit-msg`.»  :doc-group process  :doc-see process-exit-msg) (defdoc (process-exit-msg p)  «Return the process' exit status code or `NIL` if the process might still be running.    On any OS other than Plan 9 this function will always the exit status code converted to   a string - see `process-exit-code`.»  :doc-group process  :doc-see process-exit-code) (defdoc (process-post p note signal)  «Send a signal to the process.    Both a `note` and a `signal` must be specified for the sake of portability.   On Plan 9 the note (a string) is sent to the process. On any other operating system the   process instead receives the signal, which is one of the following: `'ABRT`, `'ALRM`,   `'CONT`, `'HUP`, `'INT`, `'KILL`, `'QUIT`, `'STOP`, `'TERM`, `'USR1`, `'USR2`.»  :doc-group process  :doc-see process-close)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t