Lines Matching full:sys
5 import sys
38 mswindows = (sys.platform == "win32")
45 SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), '
94 p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"],
108 p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"],
123 rc = subprocess.call([sys.executable, "-c",
124 "import sys; sys.exit(47)"])
133 [sys.executable, "-c", "while True: pass"],
138 rc = subprocess.check_call([sys.executable, "-c",
139 "import sys; sys.exit(0)"])
145 subprocess.check_call([sys.executable, "-c",
146 "import sys; sys.exit(47)"])
152 [sys.executable, "-c", "print('BDFL')"])
159 [sys.executable, "-c", "import sys; sys.exit(5)"])
165 [sys.executable, "-c", "import sys; sys.stderr.write('BDFL')"],
176 [sys.executable, "-c",
177 "import sys; sys.stdout.write(sys.stdin.read().upper())"],
184 [sys.executable, "-c",
185 "import sys; sys.stdout.write(sys.stdin.read().upper())"],
193 [sys.executable, "-c", "print('will not be run')"],
194 stdout=sys.stdout)
206 [sys.executable, "-c", "print('will not be run')"],
216 [sys.executable, "-c",
217 "import sys, time\n"
218 "sys.stdout.write('BDFL')\n"
219 "sys.stdout.flush()\n"
231 rc = subprocess.call([sys.executable, "-c",
232 'import sys, os;'
233 'sys.exit(os.getenv("FRUIT")=="banana")'],
249 p = subprocess.Popen([sys.executable, "-c", 'print("banana")'],
267 code = ('import sys; from subprocess import Popen, PIPE;'
268 'p = Popen([sys.executable, "-c", "print(\'test_stdout_none\')"],'
271 p = subprocess.Popen([sys.executable, "-c", code],
281 p = subprocess.Popen([sys.executable, "-c", 'print("banana")'],
289 # We include sys.exit() to prevent the test runner from hanging
291 args = pre_args + ["import sys; sys.exit(47)"]
303 doesnotexist = os.path.join(os.path.dirname(sys.executable),
305 self._assert_python([doesnotexist, "-c"], executable=sys.executable)
311 pre_args = [sys.executable, "-c"]
321 self._assert_python([], executable=sys.executable, shell=True)
334 python_path = os.path.realpath(sys.executable)
343 "import os, sys; "
344 "sys.stdout.write(os.getcwd()); "
345 "sys.exit(47)"],
359 self._assert_cwd(temp_dir, sys.executable, cwd=temp_dir)
364 self._assert_cwd(temp_dir, sys.executable, cwd=FakePath(temp_dir))
415 @unittest.skipIf(sys.base_prefix != sys.prefix,
421 executable=sys.executable, cwd=python_dir)
423 @unittest.skipIf(sys.base_prefix != sys.prefix,
431 executable=sys.executable)
435 p = subprocess.Popen([sys.executable, "-c",
436 'import sys; sys.exit(sys.stdin.read() == "pear")'],
450 p = subprocess.Popen([sys.executable, "-c",
451 'import sys; sys.exit(sys.stdin.read() == "pear")'],
462 p = subprocess.Popen([sys.executable, "-c",
463 'import sys; sys.exit(sys.stdin.read() == "pear")'],
470 p = subprocess.Popen([sys.executable, "-c",
471 'import sys; sys.stdout.write("orange")'],
481 p = subprocess.Popen([sys.executable, "-c",
482 'import sys; sys.stdout.write("orange")'],
492 p = subprocess.Popen([sys.executable, "-c",
493 'import sys; sys.stdout.write("orange")'],
501 p = subprocess.Popen([sys.executable, "-c",
502 'import sys; sys.stderr.write("strawberry")'],
512 p = subprocess.Popen([sys.executable, "-c",
513 'import sys; sys.stderr.write("strawberry")'],
523 p = subprocess.Popen([sys.executable, "-c",
524 'import sys; sys.stderr.write("strawberry")'],
536 p = subprocess.Popen([sys.executable, "-c",
537 'import sys, subprocess;'
538 'rc = subprocess.call([sys.executable, "-c",'
539 ' "import sys;"'
540 ' "sys.stderr.write(\'42\')"],'
542 'sys.exit(rc)'],
553 p = subprocess.Popen([sys.executable, "-c",
554 'import sys;'
555 'sys.stdout.write("apple");'
556 'sys.stdout.flush();'
557 'sys.stderr.write("orange")'],
567 p = subprocess.Popen([sys.executable, "-c",
568 'import sys;'
569 'sys.stdout.write("apple");'
570 'sys.stdout.flush();'
571 'sys.stderr.write("orange")'],
584 code = ('import sys, subprocess; '
585 'rc = subprocess.call([sys.executable, "-c", '
586 ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), '
589 p = subprocess.Popen([sys.executable, "-c", code],
598 p = subprocess.Popen([sys.executable, "-c",
606 p = subprocess.Popen([sys.executable, "-c",
607 'import sys\n'
609 'sys.stderr.write("x" * 1024)'],
615 p = subprocess.Popen([sys.executable, "-c",
616 'import sys;'
617 'sys.stdin.read(1)'],
625 with subprocess.Popen([sys.executable, "-c",
626 'import sys,os;'
627 'sys.stdout.write(os.getenv("FRUIT"))'],
635 @unittest.skipIf(sys.platform == 'win32',
653 with subprocess.Popen([sys.executable, "-c",
665 cmd = sys.executable + '\0'
671 subprocess.Popen([sys.executable, "-c", "pass#\0"])
678 subprocess.Popen([sys.executable, "-c", "pass"], env=newenv)
684 subprocess.Popen([sys.executable, "-c", "pass"], env=newenv)
690 subprocess.Popen([sys.executable, "-c", "pass"], env=newenv)
695 with subprocess.Popen([sys.executable, "-c",
696 'import sys, os;'
697 'sys.stdout.write(os.getenv("FRUIT"))'],
704 p = subprocess.Popen([sys.executable, "-c",
705 'import sys;'
706 'sys.exit(sys.stdin.read() == "pear")'],
712 p = subprocess.Popen([sys.executable, "-c",
713 'import sys; sys.stdout.write("pineapple")'],
720 p = subprocess.Popen([sys.executable, "-c",
721 'import sys; sys.stderr.write("pineapple")'],
728 p = subprocess.Popen([sys.executable, "-c",
729 'import sys,os;'
730 'sys.stderr.write("pineapple");'
731 'sys.stdout.write(sys.stdin.read())'],
743 p = subprocess.Popen([sys.executable, "-c",
744 'import sys,os,time;'
745 'sys.stderr.write("pineapple\\n");'
747 'sys.stderr.write("pear\\n");'
748 'sys.stdout.write(sys.stdin.read())'],
763 p = subprocess.Popen([sys.executable, "-c",
764 'import sys,os,time;'
765 'sys.stdout.write("a" * (64 * 1024));'
767 'sys.stdout.write("a" * (64 * 1024));'
769 'sys.stdout.write("a" * (64 * 1024));'
771 'sys.stdout.write("a" * (64 * 1024));'],
791 p = subprocess.Popen((sys.executable, "-c", "pass"), **options)
802 p = subprocess.Popen([sys.executable, "-c",
803 "import sys; sys.exit(47)"])
815 p = subprocess.Popen([sys.executable, "-c",
816 'import sys,os;'
817 'sys.stdout.write(sys.stdin.read(47));'
818 'sys.stderr.write("x" * %d);'
819 'sys.stdout.write(sys.stdin.read())' %
833 p = subprocess.Popen([sys.executable, "-c",
834 'import sys,os;'
835 'sys.stdout.write(sys.stdin.read())'],
849 sys.executable, "-c",
850 'import sys,os;' + SETBINARY +
851 'buf = sys.stdout.buffer;'
852 'buf.write(sys.stdin.readline().encode());'
856 'buf.write(sys.stdin.read().encode());'
888 p = subprocess.Popen([sys.executable, "-c",
889 'import sys,os;' + SETBINARY +
890 'buf = sys.stdout.buffer;'
913 p = subprocess.Popen([sys.executable, "-c",
914 'import sys,os;' + SETBINARY + textwrap.dedent('''
915 s = sys.stdin.readline()
917 s = sys.stdin.read()
930 p = subprocess.Popen([sys.executable, "-c", "pass"],
939 p = subprocess.Popen([sys.executable, "-c",
940 'import sys,os;' + SETBINARY + textwrap.dedent('''
941 s = sys.stdin.buffer.readline()
942 sys.stdout.buffer.write(s)
943 sys.stdout.buffer.write(b"line2\\r")
944 sys.stderr.buffer.write(b"eline2\\n")
945 s = sys.stdin.buffer.read()
946 sys.stdout.buffer.write(s)
947 sys.stdout.buffer.write(b"line4\\n")
948 sys.stdout.buffer.write(b"line5\\r\\n")
949 sys.stderr.buffer.write(b"eline6\\r")
950 sys.stderr.buffer.write(b"eline7\\r\\nz")
974 code = ("import sys; "
975 r"sys.stdout.buffer.write('1\r\n2\r3\n4'.encode('%s'))" %
977 args = [sys.executable, '-c', code]
995 code = ("import sys; "
996 r"sys.stdout.buffer.write(b'[\x80\x80]')")
997 args = [sys.executable, '-c', code]
1035 p = subprocess.Popen([sys.executable, "-c",
1036 "import sys;"
1037 "sys.stdout.write(sys.stdin.read())"],
1067 p = subprocess.Popen([sys.executable, "-c",
1078 p = subprocess.Popen([sys.executable, "-c", "pass"])
1084 p = subprocess.Popen([sys.executable,
1097 subprocess.Popen([sys.executable, "-c", "pass"], "orange")
1101 p = subprocess.Popen([sys.executable, "-c", "pass"], None)
1104 p = subprocess.Popen([sys.executable, "-c", "pass"], bufsize=None)
1109 with subprocess.Popen([sys.executable, "-c", "import sys;"
1110 "sys.stdout.write(sys.stdin.readline());"
1111 "sys.stdout.flush()"],
1185 cmd = [sys.executable, "-c", code]
1225 proc = subprocess.Popen([sys.executable, '-c',
1279 'import subprocess, sys',
1281 "[sys.executable, '-c', 'print(\"Hello World!\")'])",
1283 output = subprocess.check_output([sys.executable, '-c', code])
1308 p = subprocess.Popen([sys.executable, "-c", 'pass'],
1319 p = subprocess.Popen([sys.executable, "-c", 'pass'],
1338 args = [sys.executable, "-c",
1358 [sys.executable, '-c', 'pass'], stdin=subprocess.PIPE,
1384 argv = [sys.executable, "-c", code]
1389 cp = self.run_python("import sys; sys.exit(47)")
1396 self.run_python("import sys; sys.exit(47)", check=True)
1401 cp = self.run_python("import sys; sys.exit(0)", check=True)
1418 cp = self.run_python("import sys; sys.stderr.write('BDFL')",
1429 "import sys; sys.stdout.write(sys.stdin.read().upper())",
1436 "import sys; sys.stdout.write(sys.stdin.read().upper())",
1456 "import sys, time\n"
1457 "sys.stdout.write('BDFL')\n"
1458 "sys.stdout.flush()\n"
1470 cp = self.run_python(('import sys, os;'
1471 'sys.exit(33 if os.getenv("FRUIT")=="banana" else 31)'),
1476 cp = self.run_python(("import sys;"
1477 "sys.stdout.write('BDFL'); "
1478 "sys.stderr.write('FLUFL')"),
1533 p = subprocess.Popen([sys.executable, "-c", ""],
1547 p = subprocess.Popen([sys.executable, "-c", ""],
1650 [sys.executable, "-c",
1664 p = subprocess.Popen([sys.executable, "-c",
1693 p = subprocess.Popen([sys.executable, "-c",
1694 'import sys,os;'
1695 'sys.stdout.write(os.getenv("FRUIT"))'],
1705 p = subprocess.Popen([sys.executable, "-c", ""],
1752 self, [sys.executable, "-c", "pass"],
1767 subprocess.call([sys.executable, '-c', ''],
1774 subprocess.call([sys.executable, '-c', ''],
1780 [sys.executable, '-c', ''],
1785 [sys.executable, '-c', ''],
1794 sys.platform == 'darwin', 'setrlimit() seems to fail on OS X')
1807 subprocess.call([sys.executable, '-c', ''],
1821 fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
1822 sys.executable)
1832 [sys.executable, "-c",
1833 "import sys; sys.exit(47)"],
1836 [sys.executable, "-c",
1837 "import sys; sys.exit(47)"],
1866 fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
1867 sys.executable)
1900 p = subprocess.Popen([sys.executable, "-c", """if 1:
1901 import sys, time
1902 sys.stdout.write('x\\n')
1903 sys.stdout.flush()
1918 @unittest.skipIf(sys.platform.startswith(('netbsd', 'openbsd')),
1923 p = subprocess.Popen([sys.executable, "-c", """if 1:
1924 import sys, time
1925 sys.stdout.write('x\\n')
1926 sys.stdout.flush()
1996 out, err = subprocess.Popen([sys.executable, "-c",
1997 'import sys;'
1998 'sys.stdout.write("apple");'
1999 'sys.stdout.flush();'
2000 'sys.stderr.write("orange")'],
2044 sys.executable, "-c",
2076 p = subprocess.Popen([sys.executable, "-c",
2077 'import sys; got = sys.stdin.read();'
2078 'sys.stdout.write("got %s"%got); sys.stderr.write("err")'],
2120 p = subprocess.Popen([sys.executable, "-c",
2121 'import sys; got = sys.stdin.read();'
2122 'sys.stdout.write("got %s"%got); sys.stderr.write("err")'],
2170 import os, sys
2171 skipped_fd = int(sys.argv[1])
2179 rc = subprocess.call([sys.executable, '-c', code, str(skipped_fd)],
2209 [sys.executable, "-c", "pass"],
2235 [sys.executable, "-c", script],
2246 [sys.executable, "-c", script],
2252 abs_program = os.fsencode(sys.executable)
2253 path, program = os.path.split(sys.executable)
2281 p1 = subprocess.Popen([sys.executable, sleeper],
2287 p2 = subprocess.Popen([sys.executable, fd_status],
2307 p1 = subprocess.Popen([sys.executable, qcat],
2311 p2 = subprocess.Popen([sys.executable, qgrep, subdata],
2358 p = subprocess.Popen([sys.executable, fd_status],
2366 p = subprocess.Popen([sys.executable, fd_status],
2378 p = subprocess.Popen([sys.executable, fd_status],
2389 @unittest.skipIf(sys.platform.startswith("freebsd") and
2407 p = subprocess.Popen([sys.executable, '-c', textwrap.dedent(
2409 import os, resource, subprocess, sys, textwrap
2432 sys.stdout.flush()
2445 [sys.executable, '-c',
2447 import subprocess, sys
2448 subprocess.Popen([sys.executable, %r] +
2487 p = subprocess.Popen([sys.executable, fd_status],
2502 [sys.executable, "-c", "import sys; sys.exit(0)"],
2515 args = [sys.executable, script]
2550 with subprocess.Popen([sys.executable, fd_status],
2564 p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"],
2570 p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"],
2576 p = subprocess.Popen([sys.executable, "-c", "import sys; sys.exit(0)"],
2584 p = subprocess.Popen([sys.executable, sigchild_ignore],
2595 p = subprocess.Popen([sys.executable, "-c",
2596 'import sys;'
2597 'sys.stdout.write("apple")'],
2613 p = subprocess.Popen([sys.executable, "-c",
2614 'import sys, time;'
2634 p = subprocess.Popen([sys.executable, "-c",
2670 p = subprocess.Popen([sys.executable, fd_status],
2752 proc = subprocess.Popen([sys.executable, '-c', 'pass'])
2761 proc = subprocess.Popen([sys.executable, '-c', 'pass'])
2771 proc = subprocess.Popen([sys.executable, '-h'],
2786 proc = subprocess.Popen([sys.executable, '-h'],
2800 args = [sys.executable, '-c', 'pass']
2830 subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"],
2846 subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"],
2858 cmd = [sys.executable, "-c", "pass"]
2879 sys.stderr.write(" a DOS box should flash briefly ...\n")
2880 subprocess.call(sys.executable +
2887 [sys.executable, "-c",
2888 "import sys; sys.exit(47)"],
2898 subprocess.Popen([sys.executable, "-c", "pass"], env=BadEnv())
2902 rc = subprocess.call([sys.executable, "-c",
2903 "import sys; sys.exit(47)"],
2919 p = subprocess.Popen([sys.executable, "-c",
2926 p = subprocess.Popen([sys.executable, "-c",
2937 p = subprocess.Popen([sys.executable, "-c",
2949 p = subprocess.Popen([sys.executable, "-c",
2959 subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"],
2965 subprocess.call([sys.executable, "-c", "import sys; sys.exit(0)"],
3002 rc = subprocess.call(sys.executable +
3003 ' -c "import sys; sys.exit(47)"')
3008 p = subprocess.Popen([sys.executable, "-c", """if 1:
3009 import sys, time
3010 sys.stdout.write('x\\n')
3011 sys.stdout.flush()
3028 p = subprocess.Popen([sys.executable, "-c", """if 1:
3029 import sys, time
3030 sys.stdout.write('x\\n')
3031 sys.stdout.flush()
3032 sys.exit(42)
3098 popener([sys.executable, "-c",
3099 "import time\ntime.sleep(9)\nimport sys\n"
3100 "sys.stderr.write('\\n!runaway child!\\n')"],
3188 os.write(f, b"import sys;"
3189 b"sys.stdout.write('%d %s' % (len(sys.argv), [a.lower () for a in sys.argv]))"
3208 self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname,
3213 self.with_spaces([sys.executable, self.fname, "ab cd"], shell=1)
3217 self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname,
3222 self.with_spaces([sys.executable, self.fname, "ab cd"])
3228 with subprocess.Popen([sys.executable, "-c",
3229 "import sys;"
3230 "sys.stdout.write('stdout');"
3231 "sys.stderr.write('stderr');"],
3241 with subprocess.Popen([sys.executable, "-c",
3242 "import sys; sys.exit(100)"]) as proc:
3248 with subprocess.Popen([sys.executable, "-c",
3249 "import sys;"
3250 "sys.exit(sys.stdin.read() == 'context')"],
3264 proc = subprocess.Popen([sys.executable, '-c', 'pass'],