X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0af053088c83d1107866cb06fd6c5736d9065eee..1a169a434494175b208d0d5055bb42333d9b64b9:/services/fuse/arvados_fuse/unmount.py diff --git a/services/fuse/arvados_fuse/unmount.py b/services/fuse/arvados_fuse/unmount.py index a72da3a8dc..12d047a8f3 100644 --- a/services/fuse/arvados_fuse/unmount.py +++ b/services/fuse/arvados_fuse/unmount.py @@ -6,6 +6,7 @@ import collections import errno import os import subprocess +import sys import time @@ -116,6 +117,7 @@ def unmount(path, subtype=None, timeout=10, recursive=False): was_mounted = False attempted = False + fusermount_output = b'' if timeout is None: deadline = None else: @@ -155,6 +157,10 @@ def unmount(path, subtype=None, timeout=10, recursive=False): return was_mounted if attempted: + # Report buffered stderr from previous call to fusermount, + # now that we know it didn't succeed. + sys.stderr.buffer.write(fusermount_output) + delay = 1 if deadline: delay = min(delay, deadline - time.time()) @@ -172,6 +178,10 @@ def unmount(path, subtype=None, timeout=10, recursive=False): attempted = True try: - subprocess.check_call(["fusermount", "-u", "-z", path]) - except subprocess.CalledProcessError: - pass + subprocess.check_output( + ["fusermount", "-u", "-z", path], + stderr=subprocess.STDOUT) + except subprocess.CalledProcessError as e: + fusermount_output = e.output + else: + fusermount_output = b''