From 10cc9a605efb5063cb513a5fc39b55c09d352994 Mon Sep 17 00:00:00 2001 From: "Walter H. Yang" Date: Mon, 2 Nov 2020 23:05:04 +0800 Subject: [PATCH] docs: add example for subprocess Closes #3395 --- .../scribblings/reference/subprocess.scrbl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/racket-doc/scribblings/reference/subprocess.scrbl b/pkgs/racket-doc/scribblings/reference/subprocess.scrbl index a9f66f9574..e1959e5043 100644 --- a/pkgs/racket-doc/scribblings/reference/subprocess.scrbl +++ b/pkgs/racket-doc/scribblings/reference/subprocess.scrbl @@ -136,6 +136,19 @@ A subprocess can be used as a @tech{synchronizable event} (see @secref["sync"]). A subprocess value is @tech{ready for synchronization} when @racket[subprocess-wait] would not block; @resultItself{subprocess value}. +Example: + +@racketblock[ +(define-values (sp out in err) + (subprocess #f #f #f "/bin/ls" "-l")) +(printf "stdout:\n~a" (port->string out)) +(printf "stderr:\n~a" (port->string err)) +(close-input-port out) +(close-output-port in) +(close-input-port err) +(subprocess-wait sp) +] + @history[#:changed "6.11.0.1" @elem{Added the @racket[group] argument.} #:changed "7.4.0.5" @elem{Added waiting for a fifo without a reader as @racket[stdout] and/or @racket[stderr].}]}