Opened 9 years ago

Closed 9 years ago

#786 closed defect (fixed)

Read-char-no-hang sometimes hangs

Reported by: sswords Owned by: gb
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: Cc:

Description

Read-char-no-hang is supposed to return NIL if there is no more input available from the stream. But it hangs in the following particular example, when it's trying to read from the output stream of an external program, and that stream is still open but there's nothing on it:

? (defparameter *cat-process*
    (run-program "cat" nil
               :input :stream
               :output :stream
               :wait nil))
*CAT-PROCESS*
? (write-line "hi" (external-process-input-stream *cat-process*))
"hi"
? (finish-output (external-process-input-stream *cat-process*))
NIL
? (read-char-no-hang (external-process-output-stream *cat-process*))
#\h
? (read-char-no-hang (external-process-output-stream *cat-process*))
#\i
? (read-char-no-hang (external-process-output-stream *cat-process*))
#\Newline
? (read-char-no-hang (external-process-output-stream *cat-process*))
;; (hangs)

Another strange thing about the same situation is that LISTEN on that stream returns T even when there's no more to be read.

Change History (5)

comment:1 Changed 9 years ago by rme

What OS is this?

comment:2 Changed 9 years ago by sswords

Linux, x86-64.

comment:3 Changed 9 years ago by gb

  • Owner set to gb
  • Status changed from new to assigned

comment:4 Changed 9 years ago by gb

(In [14460]) In FD-STREAM-ADVANCE, use FD-INPUT-AVAILABLE-P (not STREAM-LISTEN) to determine whether we can read without blocking. See ticket:786.

comment:5 Changed 9 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14461]) Ensure that any streams created to read external-process output are interactive. Fixes ticket:786.

Note: See TracTickets for help on using tickets.