diff mbox series

[bug#40367] lint: Display result of checkers on stdout.

Message ID 20200401073835.5890-1-brice@waegenei.re
State Superseded
Headers show
Series [bug#40367] lint: Display result of checkers on stdout. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Brice Waegeneire April 1, 2020, 7:38 a.m. UTC
* guix/scripts/lint.scm (run-checkers): Replace 'current-error-port' by
'current-output-port'.
---
 guix/scripts/lint.scm | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

Comments

guix--- via Guix-patches via April 1, 2020, 12:25 p.m. UTC | #1
Brice,

Thanks!  As discussed on IRC, I agree stdout is better.  These are 
reports, not run-time errors.

Brice Waegeneire 写道:
> * guix/scripts/lint.scm (run-checkers): Replace 
> 'current-error-port' by
> 'current-output-port'.

It should still print *progress* messages (and any run-time 
warnings & errors) to stderr, though:

  $ guix lint sl >toot
  checking sl@5.02[cve]...

  $ guix lint sl >toot
  guix lint: error: something bad happened

This includes reverting to (isatty? (current-error-port)); 
stdout's ttyness doesn't matter.

Please also rebase your revisions onto current master 
(particularly 57e12aa).

Kind regards,

T G-R
Brice Waegeneire April 1, 2020, 1:21 p.m. UTC | #2
Hello Tobias,

On 2020-04-01 12:25, Tobias Geerinckx-Rice via Guix-patches via wrote:
> It should still print *progress* messages (and any run-time warnings &
> errors) to stderr, though:
> 
>  $ guix lint sl >toot
>  checking sl@5.02[cve]...
> 
>  $ guix lint sl >toot
>  guix lint: error: something bad happened
> 
> This includes reverting to (isatty? (current-error-port)); stdout's
> ttyness doesn't matter.
> 
> Please also rebase your revisions onto current master (particularly 
> 57e12aa).

I have take into account all of your suggestions in v2.

Thanks for the review,
- Brice
Brice Waegeneire April 21, 2020, 8:58 a.m. UTC | #3
Ping?
diff mbox series

Patch

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 8d08c484f5..87705ef6d5 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -10,6 +10,7 @@ 
 ;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -55,19 +56,21 @@ 
 
 (define (run-checkers package checkers)
   "Run the given CHECKERS on PACKAGE."
-  (let ((tty? (isatty? (current-error-port))))
-    (for-each (lambda (checker)
-                (when tty?
-                  (format (current-error-port) "checking ~a@~a [~a]...\x1b[K\r"
-                          (package-name package) (package-version package)
-                          (lint-checker-name checker))
-                  (force-output (current-error-port)))
-                (emit-warnings
-                 ((lint-checker-check checker) package)))
-              checkers)
-    (when tty?
-      (format (current-error-port) "\x1b[K")
-      (force-output (current-error-port)))))
+  (parameterize
+   ((guix-warning-port (current-output-port)))
+   (let ((tty? (isatty? (current-output-port))))
+     (for-each (lambda (checker)
+                 (when tty?
+                   (format #t "checking ~a@~a [~a]...\x1b[K\r"
+                           (package-name package) (package-version package)
+                           (lint-checker-name checker))
+                   (force-output))
+                 (emit-warnings
+                  ((lint-checker-check checker) package)))
+               checkers)
+     (when tty?
+       (format #t "\x1b[K")
+       (force-output)))))
 
 (define (list-checkers-and-exit checkers)
   ;; Print information about all available checkers and exit.