unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#34249] [PATCH] guix package: Avoid spinner at end of output.
@ 2019-01-29 19:50 Christopher Baines
  2019-01-29 20:16 ` Danny Milosavljevic
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Baines @ 2019-01-29 19:50 UTC (permalink / raw)
  To: 34249

Often guix package will report something like the following when performing
operations, for example:

  guix package -i hello
  ...
  building /gnu/store/wiwqmbi66gcr27dac3qqgrc8imyp1344-profile.drv...
  -117 packages in profile

Now there aren't -117 packages in this profile, it's just the spinner running
in to the output from Guix package. I'm not sure if this is a proper solution
for this issue, but it does work.

* guix/scripts/package.scm (build-and-use-profile): Erase the spinner before
output.
---
 guix/scripts/package.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index a633d2ee6d..4db0e72e9b 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -159,6 +159,7 @@ hooks\" run when building the profile."
                (switch-symlinks profile (basename name))
                (unless (string=? profile %current-profile)
                  (register-gc-root store name))
+               (display "\r") ; erase the spinner
                (format #t (N_ "~a package in profile~%"
                               "~a packages in profile~%"
                               count)
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#34249] [PATCH] guix package: Avoid spinner at end of output.
  2019-01-29 19:50 [bug#34249] [PATCH] guix package: Avoid spinner at end of output Christopher Baines
@ 2019-01-29 20:16 ` Danny Milosavljevic
       [not found]   ` <8736pbm6ac.fsf@gnu.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Danny Milosavljevic @ 2019-01-29 20:16 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 34249

[-- Attachment #1: Type: text/plain, Size: 566 bytes --]

Hi Christopher,
> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
> index a633d2ee6d..4db0e72e9b 100644
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -159,6 +159,7 @@ hooks\" run when building the profile."
>                 (switch-symlinks profile (basename name))
>                 (unless (string=? profile %current-profile)
>                   (register-gc-root store name))
> +               (display "\r") ; erase the spinner

In order to actually erase it, might want to do (display "\r\x1b[K") instead.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#34249: [PATCH] guix package: Avoid spinner at end of output.
       [not found]   ` <8736pbm6ac.fsf@gnu.org>
@ 2019-02-06 13:16     ` Christopher Baines
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Baines @ 2019-02-06 13:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 34249-done, 33470-done

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>
>> Hi Christopher,
>>> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
>>> index a633d2ee6d..4db0e72e9b 100644
>>> --- a/guix/scripts/package.scm
>>> +++ b/guix/scripts/package.scm
>>> @@ -159,6 +159,7 @@ hooks\" run when building the profile."
>>>                 (switch-symlinks profile (basename name))
>>>                 (unless (string=? profile %current-profile)
>>>                   (register-gc-root store name))
>>> +               (display "\r") ; erase the spinner
>>
>> In order to actually erase it, might want to do (display "\r\x1b[K") instead.
>
> And to do that, you can use (erase-current-line port).
>
> Though actually I think this should be done in ‘print-build-event’ in
> (guix status).  Probably something like the patch below, but I haven’t
> been able to quickly reproduce the initial problem.
>
> Could you give it a spin (ah ha!) and report back?
>
> If it doesn’t solve the issue, we should strace the thing to see why it
> keeps spinning after everything is “done” basically.
>
> Thanks,
> Ludo’.
>
> diff --git a/guix/status.scm b/guix/status.scm
> index e3375816c5..7a330525b0 100644
> --- a/guix/status.scm
> +++ b/guix/status.scm
> @@ -465,8 +465,14 @@ addition to build events."
>              (_
>               (spin! port))))))
>
> -  (unless print-log?
> -    (display "\r" port))                          ;erase the spinner
> +  (define erase-current-line*
> +    (if (isatty?* port)
> +        (lambda (port)
> +          (erase-current-line port)
> +          (force-output port))
> +        (const #t)))
> +
> +  (erase-current-line* port)                      ;clear the spinner
>    (match event
>      (('build-started drv . _)
>       (let ((properties (derivation-properties

I've tried out the change you pushed here [1], and it looks good to me
:) I can't see anything odd in the output now.

1: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=7473bce207af846312d5167a398f5f20bbf3e896

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-06 13:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-29 19:50 [bug#34249] [PATCH] guix package: Avoid spinner at end of output Christopher Baines
2019-01-29 20:16 ` Danny Milosavljevic
     [not found]   ` <8736pbm6ac.fsf@gnu.org>
2019-02-06 13:16     ` bug#34249: " Christopher Baines

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).