[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help needed with stderr redirection
From: |
tomas |
Subject: |
Re: help needed with stderr redirection |
Date: |
Sat, 22 Oct 2022 08:26:05 +0200 |
On Sat, Oct 22, 2022 at 01:29:05AM +0200, Csepp wrote:
> I have this short snippet of code for a Guix related utility script and
> for the love of the Glowcloud it does not want to work. I want to
> filter stderr for certain lines and they are not being redirected. When
> running the full script from a shell, it correctly captures standard
> out, but all the warnings and errors from the subprocess and/or its
> children go directly to the terminal.
>
> I looked in the Guix sources to see how others do it and found mention
> of a possibly related bug:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52835
> Is that still relevant? Because debuggs is just, khm, great, I don't
> see any clear indication of what its status is.
>
> (define (with-input-from-make thunk)
> (with-error-to-port
> (current-output-port)
> (lambda _
> (with-input-from-port
> (open-pipe* OPEN_READ "make")
> thunk))))
I think `with-error-to-port' just directs the error messages of the
current process. Not the ones of the subprocess you are invoking with
open-pipe*. Could that be the case?
To get a better idea of what's going on, you can let a subshell handle
that redirection for you, substitute `open-pipe*' with the star-less
variable and try:
(open-pipe OPEN_READ "make 2>&1")
If that works as you expect, you can work your way from there. If not,
we've learnt something :)
Cheers
--
t
signature.asc
Description: PGP signature