cl-coveralls icon indicating copy to clipboard operation
cl-coveralls copied to clipboard

uiop:run-program with string output

Open epipping opened this issue 7 years ago • 0 comments

Hi,

I was looking at how different projects on quicklisp use uiop:run-program and came across this snippet in cl-coveralls:

          (with-output-to-string (s)
            (uiop:run-program `("git" "--git-dir" ,(namestring
                                                    (merge-pathnames #P".git"
                                                                     (pathname project-dir))) ,@command)
                              :output s))))

I wanted to let you know that passing a stream as uiop:run-program's :output argument, especially one that isn't a file stream, is not very portable. But you can also get string output directly from uiop:run-program (that's far more portable because it internally uses a file) as follows:

(uiop:run-program command :output '(:string :stripped t))

epipping avatar Nov 06 '16 14:11 epipping