From e051cf0ea0a8632cce05ac0f1dd2c5a9629793bf Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Tue, 6 Mar 2018 03:04:50 +0000 Subject: [PATCH] parent: Unroll os.close() loop in first stage SSH command size: 469 (-11 bytes) Preamble size: 8946 (no change) Although the source is longer, the _compressed_ length is reduced. --- mitogen/parent.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mitogen/parent.py b/mitogen/parent.py index e4b8d888..b3971b80 100644 --- a/mitogen/parent.py +++ b/mitogen/parent.py @@ -330,7 +330,10 @@ class Stream(mitogen.core.Stream): os.dup2(0,100) os.dup2(R,0) os.dup2(r,101) - for f in R,r,W,w:os.close(f) + os.close(R) + os.close(r) + os.close(W) + os.close(w) os.environ['ARGV0']=e=sys.executable os.execv(e,['mitogen:CONTEXT_NAME']) os.write(1,'EC0\n')