From 568b5924f32138d0a4d93c56e6031d30f2d29196 Mon Sep 17 00:00:00 2001 From: neingeist Date: Tue, 27 Mar 2018 20:26:36 +0200 Subject: [PATCH] git-fsck-all: print output only on error --- git-fsck-all | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git-fsck-all b/git-fsck-all index cb28dcf..90ad506 100755 --- a/git-fsck-all +++ b/git-fsck-all @@ -31,8 +31,9 @@ def working_directory(directory): for git_directory in git_directories('.'): with working_directory(git_directory): - print('\n{}:'.format(os.getcwd())) - ret = subprocess.call(['git', 'fsck', '--no-dangling']) - if ret != 0: + try: + subprocess.check_output(['git', 'fsck', '--no-dangling'], stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as e: print((Fore.RED + 'git fsck is unhappy with {}' + Fore.RESET) .format(git_directory)) + print(e.output)