Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems in redirecting output to /bin/more

29 views
Skip to first unread message

Teemu Likonen

unread,
Jun 15, 2013, 10:19:42 AM6/15/13
to
I want to use pager /bin/more (or /usr/bin/less) internally in my
program so that certain output text is automatically written to the
pager program. Can't make it work, though. I thought the following code
should work but it doesn't:


;;; test.lisp (using SBCL)

(let ((out (sb-ext:process-input
(sb-ext:run-program "/bin/more" nil
:wait nil
:input :stream
:output t
:error t))))
(dotimes (i 100)
(format out "~A~%" i))
(force-output out))


Let's run it:

$ sbcl --script test.lisp
$

Nothing is printed. If I switch "/bin/more" to "/bin/cat" it prints
normally the numbers from 0 to 99.

Is there a way to use a pager program internally in SBCL?

D Herring

unread,
Jun 16, 2013, 1:11:25 AM6/16/13
to
On 06/15/2013 10:19 AM, Teemu Likonen wrote:
> I want to use pager /bin/more (or /usr/bin/less) internally in my
> program so that certain output text is automatically written to the
> pager program. Can't make it work, though. I thought the following code
> should work but it doesn't:
...
> Nothing is printed. If I switch "/bin/more" to "/bin/cat" it prints
> normally the numbers from 0 to 99.
>
> Is there a way to use a pager program internally in SBCL?

Might this be a problem with tty settings and the magic programs like
more use? You might wrap more in a shell script that invokes strace
to try finding the issue.

- Daniel

0 new messages