GNU bug report logs -
#56218
[PATCH] guix: inferior: Fix the behaviour of open-inferior #:error-port.
Previous Next
Reported by: Christopher Baines <mail <at> cbaines.net>
Date: Sat, 25 Jun 2022 17:19:02 UTC
Severity: normal
Tags: patch
Done: Christopher Baines <mail <at> cbaines.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Christopher Baines schreef op za 25-06-2022 om 18:18 [+0100]:
> (close-port parent)
> (close-fdes 0)
> (close-fdes 1)
> + (close-fdes 2)
> (dup2 (fileno child) 0)
> (dup2 (fileno child) 1)
> ;; Mimic 'open-pipe*'.
> - (unless (file-port? (current-error-port))
> - (close-fdes 2)
> - (dup2 (open-fdes "/dev/null" O_WRONLY) 2))
> + (dup2 (if (file-port? (current-error-port))
> + (fileno (current-error-port))
> + (open-fdes "/dev/null" O_WRONLY))
> + 2)
I don't this would work if (current-error-port) has fd 1. Would
move->fdes be appropriate here? The following seems less fragile (*)
to me (untested, also I didn't look at the context)
(move->fdes [child port] 0)
(move->fdes (dup [child port]) 1)
(if (file-port? (current-error-port))
(move->fdes (current-error-port) 2)
(move->fdes (open-file "/dev/null" O_WRONLY) 2))
(*): move->fdes automatically moves ports out of the way. Also, if one
of the moves fails, then at least (current-output-port) etc will still
have a correct fd so some error reporting should be possible
Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 2 years and 317 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.