On Mon, 13 Apr 2015, Luke Mewburn wrote:

> Hi,
> 
> I've noticed that when a long-running git operation that generates
> progress output is suspended and converted to a background process,
> the terminal still gets spammed with progress updates (to stderr).
> 
> Many years ago I fixed a similar issue in the NetBSD ftp progress
> bar code (which I wrote).
> 
> I've experimented around with a couple of different solutions, including:
> 1. suppress all progress output whilst in the background
> 2. suppress "in progress" updates whilst in the background,
>    but display the "done" message even if in the background.
> 
> In both cases, warnings were still output to the terminal.
> 
> I've attached a patch that implements (2) above.
> 
> If the consensus is that all progress messages should be suppressed,
> I can provide the (simpler) patch for that.
> 
> I've explicitly separated the in_progress_fd() function
> so that it's easier to (a) reuse elsewhere where appropriate,
> and (b) make any portability changes to the test if necessary.
> I also used getpgid(0) versus getpgrp() to avoid portability
> issues with the signature in the latter with pre-POSIX.
> 
> A minor optimisation could be to pass in struct progress *
> and to cache getpgid(0) in a member of struct progress
> in start_progress_delay(), since this value shouldn't change
> during the life of the process.

What if you suspend the task and push it into the background? Would be 
nice to inhibit progress display in that case, and resume it if the task 
returns to the foreground.

Also the display() function may be called quite a lot without 
necessarily resulting in a display output. Therefore I'd suggest adding 
in_progress_fd() to the if condition right before the printf() instead.


Nicolas
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to