Skip to content

Commit 17b78b3

Browse files
committed
Add note CL - running external program
1 parent f191a0a commit 17b78b3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Common-Lisp.adoc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,35 @@ According to Common Lisp HyperSpec:
553553
(asdf:asdf-version)
554554
----
555555

556+
== Running external program
557+
558+
=== With ASDF's UIOP
559+
560+
[source,lisp,linenums]
561+
----
562+
;; uiop:run-program returns `output', `error', `return-value'
563+
564+
;; Just run it
565+
(uiop:run-program "ls")
566+
567+
;; Output to `*standard-output*'
568+
(uiop:run-program "ls" :output t)
569+
570+
;; Output as string
571+
(uiop:run-program "ls" :output :string)
572+
;; Extra ending newline stripped
573+
(uiop:run-program "ls" :output '(:string :stripped t))
574+
575+
;; Feeding input
576+
(uiop:run-program "cat" :input (make-string-input-stream "hello world"))
577+
578+
;; With shell
579+
(uiop:run-program "ls / | grep tmp" :output '(:string :stripped t) :force-shell t)
580+
----
581+
582+
See https://common-lisp.net/project/asdf/asdf/Some-Utility-Functions.html[ASDF
583+
documentation] for more information.
584+
556585

557586
== Useful libraries
558587

0 commit comments

Comments
 (0)