Ctrl-C of a value command that reads a terminal or a FIFO

The file of < is opened with #:cancellable? #t, so Ctrl-C of
li < /dev/tty takes nothing from the terminal, and the next line goes to
the editor. tests/interactive.bjo checks it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 08:13:20 +01:00
parent 8ded734477
commit f54ceb35af
3 changed files with 11 additions and 5 deletions

View file

@ -312,7 +312,9 @@
(else
(match (record-ref seg from)
((Some path)
(match (open-input-file path)
;; Cancellable, so Ctrl-C of a read of a terminal or a FIFO takes
;; nothing from it.
(match (open-input-file path #:cancellable? #t)
((Ok in) (run-values-from sh seg in))
((Err e) (shell-error (fs-error-message e)) 1)))
(None (run-values-from sh seg (open-input-string "")))))))