Does there exist standard way to run external program in Common Lisp?

前端 未结 6 1675
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-11 15:07

In clisp, the following code works:

(defun hit-history () (shell \"tail ssqHitNum.txt\"))

However, in Clozure CL, the shell fu

6条回答
  •  孤独总比滥情好
    2021-01-11 16:02

    No, there is no standard way, but there are libraries which provide this functionality for the important implementations. For example, there's trivial-shell available in Quicklisp, which provides shell-command. (I didn't actually test it, but its among the recommended libraries on CLiki.) There is also external-program. Update: inferior-shell seems to be prefered these days, as Ehvince points out in a comment and his own answer.

    You could also use read-time conditionals to make different implementations use their respective functionality to do this.

    CCL has ccl:run-program, for example:

    CL-USER> (run-program "whoami" '() :output *standard-output*)
    foobar
    #
    

提交回复
热议问题