summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/netnsslirp.py9
1 files changed, 2 insertions, 7 deletions
diff --git a/examples/netnsslirp.py b/examples/netnsslirp.py
index 0818fba..7a1a27e 100755
--- a/examples/netnsslirp.py
+++ b/examples/netnsslirp.py
@@ -6,6 +6,7 @@
"""
import os
+import signal
import sys
if __file__.split("/")[-2:-1] == ["examples"]:
@@ -16,14 +17,11 @@ import linuxnamespaces
def main() -> None:
mainpid = os.getpid()
- rfd, wfd = os.pipe()
if os.fork() == 0:
- os.set_inheritable(rfd, True)
+ linuxnamespaces.prctl_set_pdeathsig(signal.SIGTERM)
os.execlp(
"slirp4netns",
"slirp4netns",
- "--exit-fd",
- "%d" % rfd,
"--configure",
"--disable-host-loopback",
"%d" % mainpid,
@@ -35,9 +33,6 @@ def main() -> None:
0,
linuxnamespaces.CloneFlags.NEWUSER | linuxnamespaces.CloneFlags.NEWNET,
)
- # Leave write end of --exit-fd behind as fd 252.
- os.dup2(wfd, 252)
- os.close(wfd)
os.execlp(os.environ["SHELL"], os.environ["SHELL"])