Hi, Mathieu Othacehe <othac...@gnu.org> skribis:
> From 18754c8c62eabb341e0f710d83ff435ef950ca8e Mon Sep 17 00:00:00 2001 > From: Mathieu Othacehe <othac...@gnu.org> > Date: Mon, 8 Jun 2020 15:14:49 +0200 > Subject: [PATCH] installer: utils: Dump command output to syslog when testing. > > When debugging the installation tests, it can be very handy to be able to read > "run-command" output, for instance when executing "guix system init". > > Introduce a new "invoke-with-log" procedure that is able to log a command > standard and error outputs to the syslog. Use it, only when running the > installation tests, to dump "run-command" output. > > * gnu/installer/utils.scm (open-pipe-with-stderr, invoke-with-log): New > procedures, > (invoke-log-port): new variable, > (run-command): move to the end of the file and use invoke-with-log when > running the installation tests. > --- > gnu/installer/utils.scm | 164 +++++++++++++++++++++++++++++----------- > 1 file changed, 120 insertions(+), 44 deletions(-) It’s nice, but also a bit complicated just to print stuff on the screen. :-) I found a stash with my debugging hack:
diff --git a/gnu/installer/final.scm b/gnu/installer/final.scm index 869be8814b..c084123064 100644 --- a/gnu/installer/final.scm +++ b/gnu/installer/final.scm @@ -137,7 +137,13 @@ or #f. Return #t on success and #f on failure." (lambda () (start-service 'cow-store (list (%installer-target-dir)))) (lambda () - (run-command install-command #:locale locale)) + (with-output-to-file "/dev/console" + (lambda () + (with-error-to-file "/dev/console" + (lambda () + (setvbuf (current-output-port) 'none) + (setvbuf (current-error-port) 'none) + (run-command install-command #:locale locale)))))) (lambda () (stop-service 'cow-store) ;; Remove the store overlay created at cow-store service start.
That’s enough to send the ‘guix system init’ output to the console, since we use “console=ttyS0”. It’s a gross hack of course, but maybe we can do something along these lines instead of setting up a pipe? Thanks, Ludo’.