summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2009-06-08 02:27:04 +0000
committerrfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f>2009-06-08 02:27:04 +0000
commitfad5f2f85d6adaa4433a1ba923847da450a6fcf7 (patch)
tree2628ee9846aa73a52dcada0035b2d3f46c7a7f2d
parentfbc3760ba5883fa5d8894092eb1ebb28aca207b7 (diff)
downloadpyfilesystem-git-fad5f2f85d6adaa4433a1ba923847da450a6fcf7.tar.gz
allowing MountProcess to report mount failure errors
-rw-r--r--fs/expose/fuse/__init__.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/expose/fuse/__init__.py b/fs/expose/fuse/__init__.py
index 156aa96..4bae8d1 100644
--- a/fs/expose/fuse/__init__.py
+++ b/fs/expose/fuse/__init__.py
@@ -391,7 +391,8 @@ class MountProcess(subprocess.Popen):
cmd = [sys.executable,"-c",cmd]
super(MountProcess,self).__init__(cmd,**kwds)
os.close(w)
- os.read(r,1)
+ if os.read(r,1) != "S":
+ raise RuntimeError("A FUSE error occurred")
def unmount(self):
"""Cleanly unmount the FUSE filesystem, terminating this subprocess."""
@@ -413,8 +414,19 @@ class MountProcess(subprocess.Popen):
(fs,path,opts,r,w) = pickle.loads(data)
os.close(r)
opts["foreground"] = True
- opts["ready_callback"] = lambda: os.close(w)
- mount(fs,path,**opts)
+ successful = []
+ def ready_callback():
+ successful.append(True)
+ os.write(w,"S")
+ os.close(w)
+ opts["ready_callback"] = ready_callback
+ try:
+ mount(fs,path,**opts)
+ except Exception:
+ pass
+ if not successful:
+ os.write(w,"E")
+
if __name__ == "__main__":