diff options
author | Eric Wong <e@80x24.org> | 2018-07-16 09:30:12 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2018-07-16 19:33:12 +0000 |
commit | 834de3bc0da4af53535d5c9d4975e546df9fb186 (patch) | |
tree | 3c64c15a4600301e6138735596dbf2957a7b165a | |
parent | fd9847c808c421a201ae574d93f6d0ea36d9ec63 (diff) | |
download | mwrap-834de3bc0da4af53535d5c9d4975e546df9fb186.tar.gz |
OK, Ruby blindly closing file descriptors it doesn't know about is really getting on my nerves, now.
-rwxr-xr-x | bin/mwrap | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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 |