summaryrefslogtreecommitdiffstats
path: root/Lib/test/subprocessdata/qgrep.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-12-13 07:59:39 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-12-13 07:59:39 (GMT)
commit51ee270876f4e18ec579e57772e16fce146d805e (patch)
treeca518334c744fca3ed243def81dd72d4b9f0c8ba /Lib/test/subprocessdata/qgrep.py
parentf5604853889bfbbf84b48311c63c0e775dff38cc (diff)
downloadcpython-51ee270876f4e18ec579e57772e16fce146d805e.zip
cpython-51ee270876f4e18ec579e57772e16fce146d805e.tar.gz
cpython-51ee270876f4e18ec579e57772e16fce146d805e.tar.bz2
issue7213: Open the pipes used by subprocesses with the FD_CLOEXEC flag from
the C code, using pipe2() when available. Adds unittests for close_fds and cloexec behaviors.
Diffstat (limited to 'Lib/test/subprocessdata/qgrep.py')
-rw-r--r--Lib/test/subprocessdata/qgrep.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/subprocessdata/qgrep.py b/Lib/test/subprocessdata/qgrep.py
new file mode 100644
index 0000000..6990637
--- /dev/null
+++ b/Lib/test/subprocessdata/qgrep.py
@@ -0,0 +1,10 @@
+"""When called with a single argument, simulated fgrep with a single
+argument and no options."""
+
+import sys
+
+if __name__ == "__main__":
+ pattern = sys.argv[1]
+ for line in sys.stdin:
+ if pattern in line:
+ sys.stdout.write(line)