Code for printing debug messages on a pty
This commit is contained in:
parent
63ed7f8aa9
commit
867852bf16
|
@ -0,0 +1,8 @@
|
|||
(define-interface tty-debug-interface
|
||||
(export init-tty-debug-output!
|
||||
debug-message))
|
||||
|
||||
(define-structure tty-debug tty-debug-interface
|
||||
(open scheme-with-scsh)
|
||||
(files tty-debug))
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
(define *tty-port* #f)
|
||||
|
||||
(define (init-tty-debug-output!)
|
||||
(call-with-values
|
||||
open-pty
|
||||
(lambda (input-port name)
|
||||
(set! *tty-port* (dup->outport input-port))
|
||||
(set-port-buffering *tty-port* bufpol/none)
|
||||
name)))
|
||||
|
||||
(define debug-message
|
||||
(lambda args
|
||||
(with-current-output-port*
|
||||
*tty-port*
|
||||
(lambda ()
|
||||
(for-each display args)
|
||||
(newline)))))
|
Loading…
Reference in New Issue