劣质Shell或UIOP:与后台进程进行交互 [英] Inferior Shell or UIOP: Interacting with background process
问题描述
因此,我过去实际上是使用下层外壳从SBCL Lisp运行程序的(大概UIOP就可以了).无论如何,现在我可以执行此操作,但是如果程序在后台运行,我仍然不知道如何与该程序进行交互.
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.
所有这些功能(如连接到正在运行的程序的stdin和stdout的管道和流)都被通告,只是没有记录在案.看来这是最基本的事情.
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?
感谢您的帮助.
-托德
推荐答案
您是否看过SBCL手册? RUN-PROGRAM
的选项记录在此处:
http://www.sbcl.org/manual/#Running-external-programs
Have you looked at the SBCL manual? The options for RUN-PROGRAM
are documented there:
http://www.sbcl.org/manual/#Running-external-programs
我认为您只需要创建流并通过:input
,:output
和:error
参数将它们传递到RUN-PROGRAM
.
I think you just need to create streams and pass them to RUN-PROGRAM
via the :input
, :output
, and :error
arguments.
这是一个示例,其中我给RUN-PROGRAM
流参数提供了执行gnuplot
的功能(尽管我并没有根据需要打开输入流).
https://github.com/belambert/cl-gnuplot /blob/master/src/gnuplot.lisp#L18
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
这篇关于劣质Shell或UIOP:与后台进程进行交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!