Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Understanding SB-EXT:RUN-PROCESS
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Josef Wolf  
View profile  
 More options Mar 23 2012, 6:14 am
Newsgroups: comp.lang.lisp
From: Josef Wolf <j...@raven.inka.de>
Date: Fri, 23 Mar 2012 10:14:53 +0000 (UTC)
Local: Fri, Mar 23 2012 6:14 am
Subject: Understanding SB-EXT:RUN-PROCESS
Hello,

I am trying to send some output to the printer. So I tried this:

 (let ((proc (sb-ext:run-program "a2ps" '()
                                 :search t
                                 :input :stream
                                 :output nil)))
   (format (sb-ext:process-input proc) "huhu~%")
   (sb-ext:process-close proc))

But somehow, SB-EXT:PROCESS-CLOSE seems to be ignored, and a2ps hangs
indefinitely, trying to read more input from its stdin. Does anybody have any
idea what I might be missing here?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas Neuss  
View profile  
 More options Mar 23 2012, 9:54 am
Newsgroups: comp.lang.lisp
From: Nicolas Neuss <lastn...@scipolis.de>
Date: Fri, 23 Mar 2012 14:54:16 +0100
Local: Fri, Mar 23 2012 9:54 am
Subject: Re: Understanding SB-EXT:RUN-PROCESS

Josef Wolf <j...@raven.inka.de> writes:
> Hello,

> I am trying to send some output to the printer. So I tried this:

>  (let ((proc (sb-ext:run-program "a2ps" '()
>                                  :search t
>                                  :input :stream
>                                  :output nil)))
>    (format (sb-ext:process-input proc) "huhu~%")
>    (sb-ext:process-close proc))

> But somehow, SB-EXT:PROCESS-CLOSE seems to be ignored, and a2ps hangs
> indefinitely, trying to read more input from its stdin. Does anybody have any
> idea what I might be missing here?

This works for me:

(let* ((process (sb-ext:run-program
                 "/bin/cat" '()
                 :wait nil :input :stream :output :stream))
       (input (sb-ext:process-input process))
       (output (sb-ext:process-output process)))
  (write-line "Hello" input)
  (force-output input)
  (print (read-line output))
  (close input)
  (close output))

(Maybe the missing FORCE-OUTPUT or the missing :wait nil is your problem?)

Nicolas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Josef Wolf  
View profile  
 More options Mar 26 2012, 10:55 am
Newsgroups: comp.lang.lisp
From: Josef Wolf <j...@raven.inka.de>
Date: Mon, 26 Mar 2012 14:55:41 +0000 (UTC)
Local: Mon, Mar 26 2012 10:55 am
Subject: Re: Understanding SB-EXT:RUN-PROCESS
On 2012-03-23, Nicolas Neuss <lastn...@scipolis.de> wrote:

> (let* ((process (sb-ext:run-program
>                  "/bin/cat" '()
>                  :wait nil :input :stream :output :stream))
>        (input (sb-ext:process-input process))
>        (output (sb-ext:process-output process)))
>   (write-line "Hello" input)
>   (force-output input)
>   (print (read-line output))
>   (close input)
>   (close output))

Thanks for the hint, Nicolas. That helped me to get closer to the
problem. Please see below.

> (Maybe the missing FORCE-OUTPUT or the missing :wait nil is your problem?)

No, the missing FORCE-OUTPUT don't seem to be the problem. In addition,
PROCESS-CLOSE shold call FORCE-OUTPUT before closing, IMHO.

The real problem seems to be a little bit more subtle. First thing is, I need
to add

  :wait nil

to the lambda-list. (well reading the docs helps. Sorry, my fault )

Now comes the subtle thing: Once RUN-PROGRAM is called without
the :WAIT NIL parameter, further calls to RUN-PROGRAM will no longer close the
streams properly, regardless whether :WAIT NIL parameter is included in those
later calls or not. The same holds true if I ever call SB-EXT:PROCESS-WAIT to
collect zombies. I need to quit the sbcl instance and start another one to get
it working again.

Might this be a bug in sbcl-1.0.55? Or is it related to SLIME?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »