Trent W. Buck wrote:

> As a rough-and-ready way to get a compression estimate for -9 vs. the
> default, I'm in the habit of doing running both with -v for a few
> minutes, then interrupting them.
> 
> Unfortunately, ^C changes the ETA from e.g. "3 h 20 min" to "0:17" --
> presumably because it's estimating the time to delete the incomplete
> file.  I'd prefer if this didn't happen.

Nice report.  How about this patch?

-- %< --
Subject: xz -v: Leave ETA on screen if encoding fails

After encoding each file, xz prints a report with final statistics to
replace the progress information.  In particular, the elapsed time
replaces the time remaining.  If encoding fails, though (for example
because the user interrupted it), it is probably more useful to leave
the time remaining on screen.

Signed-off-by: Jonathan Nieder <[email protected]>
---
 src/xz/coder.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/xz/coder.c b/src/xz/coder.c
index 2ee0c70..0d15f26 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -646,7 +646,8 @@ coder_run(const char *filename)
                                else
                                        success = coder_passthru(pair);
 
-                               message_progress_end(success);
+                               if (success)
+                                       message_progress_end(success);
                        }
                }
        }
-- 
1.7.0



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to