From 6d146520778ba28cdeb99386d4a2afc1af68b385 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 23 Jun 2018 16:17:24 +0000 Subject: [PATCH] issue #278: tests: fix fakessh. See source comment. This behaviour always existed, but it now seems to be triggered since we started draining the master side input buffer, which someone was prolonging the life of the PTY. --- tests/data/fakessh.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/data/fakessh.py b/tests/data/fakessh.py index 9bcf9571..08a5da3e 100755 --- a/tests/data/fakessh.py +++ b/tests/data/fakessh.py @@ -3,6 +3,7 @@ import optparse import os import shlex +import subprocess import sys parser = optparse.OptionParser() @@ -12,6 +13,11 @@ parser.disable_interspersed_args() opts, args = parser.parse_args(sys.argv[1:]) args.pop(0) # hostname + +# On Linux the TTY layer appears to begin tearing down a PTY after the last FD +# for it is closed, causing SIGHUP to be sent to its foreground group. Since +# the bootstrap overwrites the last such fd (stderr), we can't just exec it +# directly, we must hold it open just like real SSH would. So use +# subprocess.call() rather than os.execve() here. args = [''.join(shlex.split(s)) for s in args] -print args -os.execvp(args[0], args) +sys.exit(subprocess.call(args))