summaryrefslogtreecommitdiff
path: root/linuxnamespaces
diff options
context:
space:
mode:
Diffstat (limited to 'linuxnamespaces')
-rw-r--r--linuxnamespaces/__init__.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py
index ab8fa40..a1f790e 100644
--- a/linuxnamespaces/__init__.py
+++ b/linuxnamespaces/__init__.py
@@ -9,6 +9,7 @@ import asyncio
import contextlib
import errno
import fcntl
+import logging
import os
import pathlib
import socket
@@ -22,6 +23,9 @@ from .atlocation import *
from .syscalls import *
+_logger = logging.getLogger(__name__)
+
+
class run_in_fork:
"""Decorator for running the decorated function once in a separate process.
"""
@@ -46,6 +50,9 @@ class run_in_fork:
except SystemExit as err:
code = err.code
except:
+ _logger.exception(
+ "uncaught exception in run_in_fork %r", function
+ )
code = 1
os._exit(code)
@@ -115,6 +122,9 @@ class async_run_in_fork:
except SystemExit as err:
code = err.code
except:
+ _logger.exception(
+ "uncaught exception in run_in_fork %r", function
+ )
code = 1
os._exit(code)
watcher.add_child_handler(self.pid, self._child_callback)