mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
Don't stty if no terminal attributes.
This commit is contained in:
parent
19448ce93a
commit
ac704414c6
1 changed files with 9 additions and 4 deletions
|
@ -232,10 +232,15 @@
|
||||||
(define (with-stty setting thunk . o)
|
(define (with-stty setting thunk . o)
|
||||||
(let* ((port (if (pair? o) (car o) (current-input-port)))
|
(let* ((port (if (pair? o) (car o) (current-input-port)))
|
||||||
(orig-attrs (get-terminal-attributes port)))
|
(orig-attrs (get-terminal-attributes port)))
|
||||||
(dynamic-wind
|
(cond
|
||||||
(lambda () (stty setting))
|
(orig-attrs
|
||||||
thunk
|
(dynamic-wind
|
||||||
(lambda () (set-terminal-attributes! port TCSANOW orig-attrs)))))
|
(lambda () (stty setting))
|
||||||
|
thunk
|
||||||
|
(lambda () (set-terminal-attributes! port TCSANOW orig-attrs))))
|
||||||
|
(else
|
||||||
|
;; No terminal attributes means this isn't a tty.
|
||||||
|
(thunk)))))
|
||||||
|
|
||||||
;;> Run @var{thunk} with the "raw" (no canonical or echo) options
|
;;> Run @var{thunk} with the "raw" (no canonical or echo) options
|
||||||
;;> needed for a terminal application.
|
;;> needed for a terminal application.
|
||||||
|
|
Loading…
Add table
Reference in a new issue