]> arthur.barton.de Git - bup.git/commitdiff
auto_midx(): report args when failing to call a subprocess.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 26 Jan 2011 03:32:27 +0000 (19:32 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 26 Jan 2011 03:32:27 +0000 (19:32 -0800)
The exception from subprocess.call() doesn't report the path it tried to use
when it prints the "No such file or directory" error, which isn't helpful
when trying to debug problems.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
lib/bup/git.py

index 022d34716c0b349af82b6eb5ca20f3d422b42a9b..7781a515842de7ed8ea5564b4bfd307693f994fe 100644 (file)
@@ -41,7 +41,12 @@ def repo(sub = ''):
 def auto_midx(objdir):
     main_exe = os.environ.get('BUP_MAIN_EXE') or sys.argv[0]
     args = [main_exe, 'midx', '--auto', '--dir', objdir]
-    rv = subprocess.call(args, stdout=open('/dev/null', 'w'))
+    try:
+        rv = subprocess.call(args, stdout=open('/dev/null', 'w'))
+    except OSError, e:
+        # make sure 'args' gets printed to help with debugging
+        add_error('%r: exception: %s' % (args, e))
+        raise
     if rv:
         add_error('%r: returned %d' % (args, rv))