# (lispkit system call)

Library `(lispkit system call)` currently defines a single procedure `system-call` for invoking external binaries as a sub-process of the LispKit interpreter. This library is operating system specific and requires careful usage in portable code.

**(system-call&#x20;*****path args*****)** <img src="/files/STqjiJsrexexyFklGQwH" alt="" data-size="line">\
\&#xNAN;**(system-call&#x20;*****path args env*****)**\
\&#xNAN;**(system-call&#x20;*****path args env port*****)**\
\&#xNAN;**(system-call&#x20;*****path args env port input*****)**

Executes the binary at *path* passing the string representation of the elements of list *args* as command-line arguments. *env* is an association list defining environment variables. Both keys and values are strings. The output generated by executing the binary is directed towards *port*, which is a textual output port. The default for *port* corresponds to `current-output-port`, a parameter object defined by library `(lispkit port)`. Providing `#f` as *port* will send the output to `/dev/null`. *input* is an optional string which can be used to pipe data into the binary as input. The current implementation is not able to handle interactive binaries. `system-call` returns the result code for executing the binary (`0` refers to a regular exit).

```scheme
> (system-call "/bin/ls" '(-a -l))
total 863816
drwx------@  47 objecthub    1504 Jun  8 10:56 Desktop
drwx------@  96 objecthub    3072 Jun  7 16:39 Documents
drwx------@ 589 objecthub   18848 May 31 16:59 Downloads
drwx------@  41 objecthub    1312 Dec 19 22:51 Google Drive
drwx------@  84 objecthub    2688 Feb 15 18:32 Library
drwx------+  16 objecthub     512 Oct 20  2019 Movies
drwx------+  10 objecthub     320 Oct 20  2019 Music
drwx------+  10 objecthub     320 May 17 18:37 Pictures
drwxr-xr-x+   5 objecthub     160 Nov 23  2016 Public
0
> (system-call "/usr/bin/bc" '(-q) '() (current-output-port) "10*(11+9)/2\n")
100
0
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.lisppad.app/libraries/lispkit/lispkit-system-os.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
