From 0d8d19437e6da1f8d6a6218a1467c83bd35dee08 Mon Sep 17 00:00:00 2001 From: Moritz Lell Date: Wed, 30 Oct 2019 19:11:00 +0100 Subject: [PATCH] Set file descriptor as inheritable for all pythons >=3.4 This is mandated by PEP 446 --- redo/builder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/redo/builder.py b/redo/builder.py index 4b06b15..c6504fe 100644 --- a/redo/builder.py +++ b/redo/builder.py @@ -18,6 +18,11 @@ def _try_stat(filename): else: raise +def _has_pep446(): + """Test the python version whether the PEP making file descriptors + non-inheritable applies""" + return sys.version_info >= (3,4) + log_reader_pid = None stderr_fd = None @@ -42,6 +47,7 @@ def start_stdin_log_reader(status, details, pretty, color, global stderr_fd r, w = os.pipe() # main pipe to redo-log ar, aw = os.pipe() # ack pipe from redo-log --ack-fd + if _has_pep446(): os.set_inheritable(aw, True) sys.stdout.flush() sys.stderr.flush() pid = os.fork()