Commit b5eefe94 by rfkelly0

better error reporting for FUSE

parent e320e69b
......@@ -395,10 +395,16 @@ def unmount(path):
FUSE filesystem. It works, but it would probably be better to use the
'unmount' method on the MountProcess class if you have it.
"""
for num_tries in xrange(3):
p = subprocess.Popen(["fusermount","-u",path],stderr=subprocess.PIPE)
(stdout,stderr) = p.communicate()
if p.returncode != 0 and "not mounted" not in stderr:
raise OSError("filesystem could not be unmounted: " + path)
if p.returncode == 0:
return
if "not mounted" in stderr:
return
if "not found" in stderr:
return
raise OSError("filesystem could not be unmounted: %s (%s) " % (path,stderr,))
class MountProcess(subprocess.Popen):
......@@ -456,7 +462,7 @@ class MountProcess(subprocess.Popen):
super(MountProcess,self).__init__(cmd,**kwds)
os.close(w)
if os.read(r,1) != "S":
raise RuntimeError("A FUSE error occurred")
raise RuntimeError("FUSE error: " + os.read(r,20))
def unmount(self):
"""Cleanly unmount the FUSE filesystem, terminating this subprocess."""
......@@ -510,10 +516,13 @@ class MountProcess(subprocess.Popen):
opts["unmount_callback"] = unmount_callback
try:
mount(fs,path,**opts)
except Exception:
pass
except Exception, e:
os.write(w,"E"+str(e))
os.close(w)
else:
if not successful:
os.write(w,"E")
os.close(w)
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment