Hi Danny,
Danny Milosavljevic <dannym@scratchpost.org> writes:
Hmm. What makes you think that 'invoke' swallowed the output? You
might be right, but 'invoke' is used quite widely by now in Guix,
including to invoke 'make' in gnu-build-system, and I haven't seen
reports of it swallowing output.
I looked at the code. 'invoke' calls 'system*' which calls
'scm_open_process' (in libguile/posix.c) with an empty mode string.
In this case, the child STDOUT becomes (current-output-port) from the
parent if (current-output-port) is a "file port", i.e. a Guile port
backed by a POSIX file descriptor, e.g. a file, socket or pipe. If it's
a Guile port that's not backed by a file descriptor, e.g. a custom port,
soft port, string port, bytevector port, etc, then indeed the child
output will go to /dev/null instead.
(Note that the port returned by 'open-pipe*' when used in OPEN_BOTH mode
is also a soft port and not considered a file port, even though it is
internally backed by two file ports.)
Ditto for STDERR, except that it uses (current-error-port).
So, if 'invoke' seems to be swallowing output, it's probably because it
was called within the dynamic extent of 'with-output-to-port',
'with-error-to-port', 'with-output-to-string', or similar.
Regards,
Mark