From 0a9c3dcc40febb3c44fe8ec491381d0392a8144f Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 27 Jan 2019 01:25:12 +0000 Subject: [PATCH] issue #477: missing stub-su.py from 137f5fa6c5cea5ca13524a34fefe10eb17b52ab5 --- tests/data/stubs/stub-su.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 tests/data/stubs/stub-su.py diff --git a/tests/data/stubs/stub-su.py b/tests/data/stubs/stub-su.py new file mode 100755 index 00000000..c32c91de --- /dev/null +++ b/tests/data/stubs/stub-su.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python + +import json +import os +import subprocess +import sys + +os.environ['ORIGINAL_ARGV'] = json.dumps(sys.argv) +os.environ['THIS_IS_STUB_SU'] = '1' + +# This must be a child process and not exec() since Mitogen replaces its stderr +# descriptor, causing the last user of the slave PTY to close it, resulting in +# the master side indicating EIO. +os.execlp('sh', 'sh', '-c', sys.argv[sys.argv.index('-c') + 1])