Commit a9aecf14 by rfkelly0

fuse: replace debugging prints with logger

parent 20ad1a03
...@@ -15,7 +15,7 @@ implementations of this interface such as: ...@@ -15,7 +15,7 @@ implementations of this interface such as:
""" """
__version__ = "0.4.0a11" __version__ = "0.4.0a12"
__author__ = "Will McGugan (will@willmcgugan.com)" __author__ = "Will McGugan (will@willmcgugan.com)"
# 'base' imports * from 'path' and 'errors', so their # 'base' imports * from 'path' and 'errors', so their
......
...@@ -56,7 +56,10 @@ import errno ...@@ -56,7 +56,10 @@ import errno
import time import time
import stat as statinfo import stat as statinfo
import subprocess import subprocess
import pickle import cPickle
import logging
logger = logging.getLogger("fs.expose.fuse")
from fs.base import flags_to_mode, threading from fs.base import flags_to_mode, threading
from fs.errors import * from fs.errors import *
...@@ -92,7 +95,14 @@ def handle_fs_errors(func): ...@@ -92,7 +95,14 @@ def handle_fs_errors(func):
func = convert_fs_errors(func) func = convert_fs_errors(func)
@wraps(func) @wraps(func)
def wrapper(*args,**kwds): def wrapper(*args,**kwds):
#logger.debug("CALL %r %s",name,repr(args))
try:
res = func(*args,**kwds) res = func(*args,**kwds)
except Exception:
#logger.exception("ERR %r %s",name,repr(args))
raise
else:
#logger.exception("OK %r %s %r",name,repr(args),res)
if res is None: if res is None:
return 0 return 0
return res return res
...@@ -515,16 +525,20 @@ class MountProcess(subprocess.Popen): ...@@ -515,16 +525,20 @@ class MountProcess(subprocess.Popen):
def __init__(self, fs, path, fuse_opts={}, nowait=False, **kwds): def __init__(self, fs, path, fuse_opts={}, nowait=False, **kwds):
self.path = path self.path = path
if nowait or kwds.get("close_fds",False): if nowait or kwds.get("close_fds",False):
cmd = 'from fs.expose.fuse import MountProcess; ' cmd = 'import cPickle; '
cmd = cmd + 'MountProcess._do_mount_nowait(%s)' cmd = cmd + 'data = cPickle.loads(%s); '
cmd = cmd % (repr(pickle.dumps((fs,path,fuse_opts),-1)),) cmd = cmd + 'from fs.expose.fuse import MountProcess; '
cmd = cmd + 'MountProcess._do_mount_nowait(data)'
cmd = cmd % (repr(cPickle.dumps((fs,path,fuse_opts),-1)),)
cmd = [sys.executable,"-c",cmd] cmd = [sys.executable,"-c",cmd]
super(MountProcess,self).__init__(cmd,**kwds) super(MountProcess,self).__init__(cmd,**kwds)
else: else:
(r,w) = os.pipe() (r,w) = os.pipe()
cmd = 'from fs.expose.fuse import MountProcess; ' cmd = 'import cPickle; '
cmd = cmd + 'MountProcess._do_mount_wait(%s)' cmd = cmd + 'data = cPickle.loads(%s); '
cmd = cmd % (repr(pickle.dumps((fs,path,fuse_opts,r,w),-1)),) cmd = cmd + 'from fs.expose.fuse import MountProcess; '
cmd = cmd + 'MountProcess._do_mount_wait(data)'
cmd = cmd % (repr(cPickle.dumps((fs,path,fuse_opts,r,w),-1)),)
cmd = [sys.executable,"-c",cmd] cmd = [sys.executable,"-c",cmd]
super(MountProcess,self).__init__(cmd,**kwds) super(MountProcess,self).__init__(cmd,**kwds)
os.close(w) os.close(w)
...@@ -560,7 +574,7 @@ class MountProcess(subprocess.Popen): ...@@ -560,7 +574,7 @@ class MountProcess(subprocess.Popen):
@staticmethod @staticmethod
def _do_mount_nowait(data): def _do_mount_nowait(data):
"""Perform the specified mount, return without waiting.""" """Perform the specified mount, return without waiting."""
(fs,path,opts) = pickle.loads(data) (fs,path,opts) = data
opts["foreground"] = True opts["foreground"] = True
def unmount_callback(): def unmount_callback():
fs.close() fs.close()
...@@ -570,7 +584,7 @@ class MountProcess(subprocess.Popen): ...@@ -570,7 +584,7 @@ class MountProcess(subprocess.Popen):
@staticmethod @staticmethod
def _do_mount_wait(data): def _do_mount_wait(data):
"""Perform the specified mount, signalling when ready.""" """Perform the specified mount, signalling when ready."""
(fs,path,opts,r,w) = pickle.loads(data) (fs,path,opts,r,w) = data
os.close(r) os.close(r)
opts["foreground"] = True opts["foreground"] = True
successful = [] successful = []
......
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