[gparted] Enable %age complete display from e2fsck command (#697662)



commit 59a22673da55eb185b8bd1e25cc9a729e24c24bb
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Jun 16 15:37:59 2013 +0100

    Enable %age complete display from e2fsck command (#697662)
    
    Enable the text progress bar and percentage complete from the e2fsck
    command.  Looks like:
    
        # e2fsck -f -y -v -C 0 /dev/sda8
        e2fsck 1.41.12 (17-May-2010)
        Pass 1: Checking inodes, blocks, and sizes
        Pass 2: Checking directory structure
        test8: |=========================================               / 73.6%
    
    Note that e2fsck deliberately brackets the progress bar with control-A
    and control-B characters when it detects that it is not being run from a
    terminal so that logsave(8) can exclude the progress bar from being
    written to a log file.  As GParted doesn't run e2fsck via a pty it
    receives these control characters.  Ignore them.
    
    References:
    Change e2fsck to bracket its progress bar output with ctrl-A and ctrl-B
    http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=bc34d6be65cb93a65451ad209cfea2f98b03fd22
    
    Don't print ^A and ^B chars when e2fsck is talking directly to a tty
    http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=54a31a3b2e432c124aa03442f2983c4f4d4a974c
    
    Closes Bug #697662 - Do not hide the progress of the tools used

 src/PipeCapture.cc |    3 +++
 src/ext2.cc        |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/PipeCapture.cc b/src/PipeCapture.cc
index 02dba80..5ec1fa3 100644
--- a/src/PipeCapture.cc
+++ b/src/PipeCapture.cc
@@ -64,6 +64,9 @@ bool PipeCapture::OnReadable( Glib::IOCondition condition )
                                buff += '\n';
                                backcount = 0;
                        }
+                       else if (*s == '\x01' || *s == '\x02' )
+                               //Skip Ctrl-A and Ctrl-B chars e2fsck uses to bracket the progress bar
+                               continue;
                        else {
                                if (backcount) {
                                        buff.erase( buff.length() - backcount, backcount );
diff --git a/src/ext2.cc b/src/ext2.cc
index 47f1eab..38a70da 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -194,7 +194,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
 
 bool ext2::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       exit_status = execute_command( "e2fsck -f -y -v " + partition.get_path(), operationdetail,
+       exit_status = execute_command( "e2fsck -f -y -v -C 0 " + partition.get_path(), operationdetail,
                                       false, true );
 
        //exitstatus 256 isn't documented, but it's returned when the 'FILE SYSTEM IS MODIFIED'


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]