]> arthur.barton.de Git - bup.git/commitdiff
fsck: Hide error when probing par2 capabilities
authorGernot Schulz <news@gernot-schulz.com>
Fri, 22 Nov 2019 13:41:39 +0000 (14:41 +0100)
committerRob Browning <rlb@defaultvalue.org>
Fri, 29 Nov 2019 21:20:29 +0000 (15:20 -0600)
bup-fsck checks for the availability of par2's -t1 option by executing
it (for the reason see dc10c9172e1197c77c246ea75aae63388dcd641e).  If
the option is unavailable, par2 returns an error ("Invalid option
specified: -t1") which is not muted by the -qq option.

To hide this harmless par2 error during bup-fsck invocations the
subprocess call needs to capture stderr.

Signed-off-by: Gernot Schulz <post@gernot-schulz.com>
[rlb@defaultvalue.org: expand abbreviated hash to full hash above]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
cmd/fsck-cmd.py

index 8ba698c9d159388407e4e256554eb822cdcb8582..08c6fb821033ef56b9f3f29235abda3e3be5410e 100755 (executable)
@@ -53,7 +53,9 @@ def is_par2_parallel():
         canary = tmpdir + '/canary'
         with open(canary, 'w') as f:
             print('canary', file=f)
-        rc = call(('par2', 'create', '-qq', '-t1', canary))
+        p = subprocess.Popen(['par2', 'create', '-qq', '-t1', canary],
+                             stdout=nullf, stderr=nullf, stdin=nullf)
+        rc = p.wait()
         return rc == 0
     finally:
         rmtree(tmpdir)