[Openmcl-devel] Some smoking gun terminal weirdness

Ron Garret ron at flownet.com
Thu Mar 15 09:28:45 PDT 2018


After a great deal of wailing and gnashing of teeth I have finally found at least one reliably reproducible bit of smoking-gun weirdness with regards to raw input behavior in CCL.  Here is the code:

Clozure Common Lisp Version 1.12-dev/v1.12-dev.0-35-g09fc19b  (DarwinX8664)
? (require :pty)
:PTY
("PTY")
? (defmacro with-raw-input (&body body)
  `(rlet ((attr :termios))
     (unwind-protect
          (progn
            (#_tcgetattr 0 attr)
            (ccl::set-tty-raw 0)
            , at body)
       (#_tcsetattr 0 #$TCSAFLUSH attr))))
WITH-RAW-INPUT
? (defun foo (n)
  (with-raw-input (print 123) (sleep n) (print 456)))
FOO
? (foo 0)

123 
456 
456
? (foo 1)

456 
456
? 


This behavior manifests itself only on OS X.  On Linux it works properly.  On OS X, I get this weird behavior whether or not I’m running under rlwrap.

I have not yet tried to reproduce this behavior in C so I do not yet know whether it is a CCL bug or an OS X terminal bug, but the latter seems extremely unlikely.

rg




More information about the Openmcl-devel mailing list