summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Daniel Honles <terence@honles.com>2013-03-20 00:26:00 -0700
committerTerence Daniel Honles <terence@honles.com>2013-03-20 00:26:00 -0700
commit27d76e442d96139f9038d83d23275877fa3d3c9b (patch)
tree799769db96a65089bc40c59fdebce9c840e3e80c
parentff89f0a48e4a71efaa3cc7e2faed5e69431af9d3 (diff)
downloadfusepy-27d76e442d96139f9038d83d23275877fa3d3c9b.tar.gz
safely save and restore signal handler
calls to `signal.signal` not on the main thread would raise a `ValueError`. Resolving by catching that exception and continuing
-rw-r--r--fuse.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/fuse.py b/fuse.py
index e4b79e2..7a03d61 100644
--- a/fuse.py
+++ b/fuse.py
@@ -387,12 +387,18 @@ class FUSE(object):
op = partial(self._wrapper, getattr(self, name))
setattr(fuse_ops, name, prototype(op))
- old_handler = signal(SIGINT, SIG_DFL)
+ try:
+ old_handler = signal(SIGINT, SIG_DFL)
+ except ValueError:
+ old_handler = SIG_DFL
err = _libfuse.fuse_main_real(len(args), argv, pointer(fuse_ops),
sizeof(fuse_ops), None)
- signal(SIGINT, old_handler)
+ try:
+ signal(SIGINT, old_handler)
+ except ValueError:
+ pass
del self.operations # Invoke the destructor
if err: