about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rwxr-xr-xbin/mwrap7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/mwrap b/bin/mwrap
index 964fdf8..9f67dab 100755
--- a/bin/mwrap
+++ b/bin/mwrap
@@ -26,4 +26,11 @@ if ENV['MWRAP'] =~ /dump_fd:(\d+)/
     opts[dump_fd] = dump_io
   end
 end
+
+# allow inheriting FDs from systemd
+n = ENV['LISTEN_FDS']
+if n && ENV['LISTEN_PID'].to_i == $$
+  n = 3 + n.to_i
+  (3...n).each { |fd| opts[fd] = IO.new(fd) }
+end
 exec *ARGV, opts