* [PATCH] bin/mwrap: support LISTEN_FDS env from systemd
@ 2018-07-16 9:30 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2018-07-16 9:30 UTC (permalink / raw)
To: mwrap-public
OK, Ruby blindly closing file descriptors it doesn't know about
is really getting on my nerves, now.
---
bin/mwrap | 7 +++++++
1 file changed, 7 insertions(+)
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
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-16 9:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16 9:30 [PATCH] bin/mwrap: support LISTEN_FDS env from systemd Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).