diff options
author | Terence Daniel Honles <terence@honles.com> | 2013-03-20 00:26:00 -0700 |
---|---|---|
committer | Terence Daniel Honles <terence@honles.com> | 2013-03-20 00:26:00 -0700 |
commit | 27d76e442d96139f9038d83d23275877fa3d3c9b (patch) | |
tree | 799769db96a65089bc40c59fdebce9c840e3e80c | |
parent | ff89f0a48e4a71efaa3cc7e2faed5e69431af9d3 (diff) | |
download | fusepy-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.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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: |