You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking at how different projects on quicklisp use uiop:run-program and came across this snippet in common-doc:
(defmethodexpand-macro ((plot gnuplot))
"Take the gnuplot source code from the children and the image name, render itwith gnuplot into an image."
(let* ((pathname (absolute-path (image-path plot)))
;; The gnuplot commands
(text (text (first (children plot))))
;; The gnuplot commands to set output format, file etc.
(input (formatnil"set term pngcairo; set output ~S; ~A~%"
(namestringpathname)
text))
;; The gnuplot command
(command "gnuplot"))
;; Run
(handler-case
(progn
(with-input-from-string (stream input)
(uiop:run-program command :inputstream))
(make-image (namestring (relativize-pathname pathname))))
(t ()
(make-text "gnuplot error.")))))
I wanted to let you know that passing input to uiop:run-program through a stream, especially one that isn't a file stream, is not very portable. But you can also pass strings directly (that's far more portable because it internally uses a file). So e.g.
Hi,
I was looking at how different projects on quicklisp use
uiop:run-program
and came across this snippet in common-doc:I wanted to let you know that passing input to
uiop:run-program
through a stream, especially one that isn't a file stream, is not very portable. But you can also pass strings directly (that's far more portable because it internally uses a file). So e.g.will print "hello, world".
The text was updated successfully, but these errors were encountered: