xxx! shell: Work around Mes' broken 'port?'.

XXX: The Guile version should not be changed.

* gash/shell.scm (process-redir): Wrap ports in a list so that they
can be distinguished from numbers.
This commit is contained in:
Timothy Sample 2022-12-22 13:30:37 -06:00
parent 9c5af49c81
commit 06dad4deba
1 changed files with 5 additions and 2 deletions

View File

@ -179,9 +179,12 @@ parameter to be updated, the port that should be its new value (or
@code{#f} if it should be considered closed), and a boolean indicating
if it is our responsibility to close the port."
;; On Mes, 'port?' does not really work. Hence, if TARGET is a
;; port, it will be wrapped in a list. This means that the 'pair?'
;; case below is actaully checking for a port.
(define* (make-processed-redir fd target #:optional (open-flags 0))
(let ((port (match target
((? port?) target)
((? pair?) (car target))
((? string?) (open target open-flags))
;; TODO: Verify open-flags.
((? integer?) ((fd->current-port target)))
@ -215,7 +218,7 @@ if it is our responsibility to close the port."
(let ((port (tmpfile)))
(display text port)
(seek port 0 SEEK_SET)
(make-processed-redir fd port)))))
(make-processed-redir fd (list port))))))
(define (sh:set-redirects redirs)
"Put the redirects @var{redirs} into effect."