Inferior Shell or UIOP: Interacting with background process

这一生的挚爱 提交于 2020-01-03 13:36:59

问题


So, I got past actually getting a program to run from SBCL Lisp using inferior-shell (presumably UIOP would be just fine). Anyway, now that I can do that, I still have no clue how to interact with the program if it is running in the background.

All of this functionality like pipes and streams connected to the stdin and stdout of the running program are advertised, just not documented. It would seem like this is the most basic thing to do.

Does anybody have an example of doing such a thing?

Any help is appreciated.

-Todd


回答1:


Have you looked at the SBCL manual? The options for RUN-PROGRAM are documented there: http://www.sbcl.org/manual/#Running-external-programs

I think you just need to create streams and pass them to RUN-PROGRAM via the :input, :output, and :error arguments.

Here is an example where I give RUN-PROGRAM stream arguments to execute gnuplot (although I'm not leaving the input stream open as you want). https://github.com/belambert/cl-gnuplot/blob/master/src/gnuplot.lisp#L18



来源:https://stackoverflow.com/questions/39271651/inferior-shell-or-uiop-interacting-with-background-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!