Lines Matching full:sys
9 import sys
55 mswindows = (sys.platform == "win32")
62 SETBINARY = ('import msvcrt; msvcrt.setmode(sys.stdout.fileno(), '
71 ZERO_RETURN_CMD = (sys.executable, '-c', 'pass')
147 rc = subprocess.call([sys.executable, "-c",
148 "import sys; sys.exit(47)"])
157 [sys.executable, "-c", "while True: pass"],
168 subprocess.check_call([sys.executable, "-c",
169 "import sys; sys.exit(47)"])
175 [sys.executable, "-c", "print('BDFL')"])
190 [sys.executable, "-c", "import sys; sys.exit(5)"])
196 [sys.executable, "-c", "import sys; sys.stderr.write('BDFL')"],
207 [sys.executable, "-c",
208 "import sys; sys.stdout.write(sys.stdin.read().upper())"],
215 [sys.executable, "-c",
216 "import sys; sys.stdout.write(sys.stdin.read().upper())"],
223 [sys.executable, "-c",
224 "import sys; print('XX' if sys.stdin.read() else '')"],
230 [sys.executable, "-c",
231 "import sys; print('XX' if sys.stdin.read() else '')"],
237 [sys.executable, "-c",
238 "import sys; print('XX' if sys.stdin.read() else '')"],
244 [sys.executable, "-c", "print('foo')"],
252 [sys.executable, "-c", "print('will not be run')"],
253 stdout=sys.stdout)
265 [sys.executable, "-c", "print('will not be run')"],
275 [sys.executable, "-c",
276 "import sys, time\n"
277 "sys.stdout.write('BDFL')\n"
278 "sys.stdout.flush()\n"
290 rc = subprocess.call([sys.executable, "-c",
291 'import sys, os;'
292 'sys.exit(os.getenv("FRUIT")=="banana")'],
308 p = subprocess.Popen([sys.executable, "-c", 'print("banana")'],
326 code = ('import sys; from subprocess import Popen, PIPE;'
327 'p = Popen([sys.executable, "-c", "print(\'test_stdout_none\')"],'
330 p = subprocess.Popen([sys.executable, "-c", code],
340 p = subprocess.Popen([sys.executable, "-c", 'print("banana")'],
348 # We include sys.exit() to prevent the test runner from hanging
350 args = pre_args + ["import sys; sys.exit(47)"]
362 doesnotexist = os.path.join(os.path.dirname(sys.executable),
364 self._assert_python([doesnotexist, "-c"], executable=sys.executable)
367 doesnotexist = os.path.join(os.path.dirname(sys.executable),
370 executable=os.fsencode(sys.executable))
373 doesnotexist = os.path.join(os.path.dirname(sys.executable),
376 executable=FakePath(sys.executable))
382 pre_args = [sys.executable, "-c"]
392 self._assert_python([], executable=sys.executable, shell=True)
396 self._assert_python([], executable=os.fsencode(sys.executable),
401 self._assert_python([], executable=FakePath(sys.executable),
415 python_path = os.path.realpath(sys.executable)
424 "import os, sys; "
425 "buf = sys.stdout.buffer; "
428 "sys.exit(47)"],
442 self._assert_cwd(temp_dir, sys.executable, cwd=temp_dir)
447 self._assert_cwd(temp_dir, sys.executable, cwd=os.fsencode(temp_dir))
452 self._assert_cwd(temp_dir, sys.executable, cwd=FakePath(temp_dir))
503 @unittest.skipIf(sys.base_prefix != sys.prefix,
509 executable=sys.executable, cwd=python_dir)
511 @unittest.skipIf(sys.base_prefix != sys.prefix,
519 executable=sys.executable)
523 p = subprocess.Popen([sys.executable, "-c",
524 'import sys; sys.exit(sys.stdin.read() == "pear")'],
538 p = subprocess.Popen([sys.executable, "-c",
539 'import sys; sys.exit(sys.stdin.read() == "pear")'],
550 p = subprocess.Popen([sys.executable, "-c",
551 'import sys; sys.exit(sys.stdin.read() == "pear")'],
558 p = subprocess.Popen([sys.executable, "-c",
559 'import sys; sys.stdout.write("orange")'],
569 p = subprocess.Popen([sys.executable, "-c",
570 'import sys; sys.stdout.write("orange")'],
580 p = subprocess.Popen([sys.executable, "-c",
581 'import sys; sys.stdout.write("orange")'],
589 p = subprocess.Popen([sys.executable, "-c",
590 'import sys; sys.stderr.write("strawberry")'],
600 p = subprocess.Popen([sys.executable, "-c",
601 'import sys; sys.stderr.write("strawberry")'],
611 p = subprocess.Popen([sys.executable, "-c",
612 'import sys; sys.stderr.write("strawberry")'],
624 p = subprocess.Popen([sys.executable, "-c",
625 'import sys, subprocess;'
626 'rc = subprocess.call([sys.executable, "-c",'
627 ' "import sys;"'
628 ' "sys.stderr.write(\'42\')"],'
630 'sys.exit(rc)'],
641 p = subprocess.Popen([sys.executable, "-c",
642 'import sys;'
643 'sys.stdout.write("apple");'
644 'sys.stdout.flush();'
645 'sys.stderr.write("orange")'],
655 p = subprocess.Popen([sys.executable, "-c",
656 'import sys;'
657 'sys.stdout.write("apple");'
658 'sys.stdout.flush();'
659 'sys.stderr.write("orange")'],
672 code = ('import sys, subprocess; '
673 'rc = subprocess.call([sys.executable, "-c", '
674 ' "import os, sys; sys.exit(os.write(sys.stdout.fileno(), '
677 p = subprocess.Popen([sys.executable, "-c", code],
686 p = subprocess.Popen([sys.executable, "-c",
694 p = subprocess.Popen([sys.executable, "-c",
695 'import sys\n'
697 'sys.stderr.write("x" * 1024)'],
703 p = subprocess.Popen([sys.executable, "-c",
704 'import sys;'
705 'sys.stdin.read(1)'],
725 [sys.executable, "-c",
726 'import sys; sys.stdin.read(); sys.stdout.write("out"); '
727 'sys.stderr.write("error!")'],
750 [sys.executable, "-c",
751 'import sys; sys.stdin.read(); sys.stdout.write("out"); '
752 'sys.stderr.write("error!")'],
778 with subprocess.Popen([sys.executable, "-c",
779 'import sys,os;'
780 'sys.stdout.write(os.getenv("FRUIT"))'],
788 @unittest.skipIf(sys.platform == 'win32',
807 with subprocess.Popen([sys.executable, "-c",
819 cmd = sys.executable + '\0'
825 subprocess.Popen([sys.executable, "-c", "pass#\0"])
849 with subprocess.Popen([sys.executable, "-c",
850 'import sys, os;'
851 'sys.stdout.write(os.getenv("FRUIT"))'],
858 p = subprocess.Popen([sys.executable, "-c",
859 'import sys;'
860 'sys.exit(sys.stdin.read() == "pear")'],
866 p = subprocess.Popen([sys.executable, "-c",
867 'import sys; sys.stdout.write("pineapple")'],
874 p = subprocess.Popen([sys.executable, "-c",
875 'import sys; sys.stderr.write("pineapple")'],
882 p = subprocess.Popen([sys.executable, "-c",
883 'import sys,os;'
884 'sys.stderr.write("pineapple");'
885 'sys.stdout.write(sys.stdin.read())'],
897 p = subprocess.Popen([sys.executable, "-c",
898 'import sys,os,time;'
899 'sys.stderr.write("pineapple\\n");'
901 'sys.stderr.write("pear\\n");'
902 'sys.stdout.write(sys.stdin.read())'],
917 p = subprocess.Popen([sys.executable, "-c",
918 'import sys,os,time;'
919 'sys.stdout.write("a" * (64 * 1024));'
921 'sys.stdout.write("a" * (64 * 1024));'
923 'sys.stdout.write("a" * (64 * 1024));'
925 'sys.stdout.write("a" * (64 * 1024));'],
956 p = subprocess.Popen([sys.executable, "-c",
957 "import sys; sys.exit(47)"])
969 p = subprocess.Popen([sys.executable, "-c",
970 'import sys,os;'
971 'sys.stdout.write(sys.stdin.read(47));'
972 'sys.stderr.write("x" * %d);'
973 'sys.stdout.write(sys.stdin.read())' %
987 p = subprocess.Popen([sys.executable, "-c",
988 'import sys,os;'
989 'sys.stdout.write(sys.stdin.read())'],
1003 sys.executable, "-c",
1004 'import sys,os;' + SETBINARY +
1005 'buf = sys.stdout.buffer;'
1006 'buf.write(sys.stdin.readline().encode());'
1010 'buf.write(sys.stdin.read().encode());'
1042 p = subprocess.Popen([sys.executable, "-c",
1043 'import sys,os;' + SETBINARY +
1044 'buf = sys.stdout.buffer;'
1067 p = subprocess.Popen([sys.executable, "-c",
1068 'import sys,os;' + SETBINARY + textwrap.dedent('''
1069 s = sys.stdin.readline()
1071 s = sys.stdin.read()
1093 p = subprocess.Popen([sys.executable, "-c",
1094 'import sys,os;' + SETBINARY + textwrap.dedent('''
1095 s = sys.stdin.buffer.readline()
1096 sys.stdout.buffer.write(s)
1097 sys.stdout.buffer.write(b"line2\\r")
1098 sys.stderr.buffer.write(b"eline2\\n")
1099 s = sys.stdin.buffer.read()
1100 sys.stdout.buffer.write(s)
1101 sys.stdout.buffer.write(b"line4\\n")
1102 sys.stdout.buffer.write(b"line5\\r\\n")
1103 sys.stderr.buffer.write(b"eline6\\r")
1104 sys.stderr.buffer.write(b"eline7\\r\\nz")
1127 code = ("import sys; "
1128 r"sys.stdout.buffer.write('1\r\n2\r3\n4'.encode('%s'))" %
1130 args = [sys.executable, '-c', code]
1148 code = ("import sys; "
1149 r"sys.stdout.buffer.write(b'[\x80\x80]')")
1150 args = [sys.executable, '-c', code]
1188 p = subprocess.Popen([sys.executable, "-c",
1189 "import sys;"
1190 "sys.stdout.write(sys.stdin.read())"],
1220 p = subprocess.Popen([sys.executable, "-c",
1237 p = subprocess.Popen([sys.executable,
1260 with subprocess.Popen([sys.executable, "-c", "import sys;"
1261 "sys.stdout.write(sys.stdin.readline());"
1262 "sys.stdout.flush()"],
1337 cmd = [sys.executable, "-c", code]
1377 proc = subprocess.Popen([sys.executable, '-c',
1431 'import subprocess, sys',
1433 "[sys.executable, '-c', 'print(\"Hello World!\")'])",
1435 output = subprocess.check_output([sys.executable, '-c', code])
1509 args = [sys.executable, "-c",
1562 subprocess.run([sys.executable, "-c", "pass"])
1567 subprocess.run([sys.executable, "-c", "pass"])
1574 argv = [sys.executable, "-c", code]
1579 cp = self.run_python("import sys; sys.exit(47)")
1586 self.run_python("import sys; sys.exit(47)", check=True)
1608 cp = self.run_python("import sys; sys.stderr.write('BDFL')",
1619 "import sys; sys.stdout.write(sys.stdin.read().upper())",
1626 "import sys; sys.stdout.write(sys.stdin.read().upper())",
1646 "import sys, time\n"
1647 "sys.stdout.write('BDFL')\n"
1648 "sys.stdout.flush()\n"
1660 cp = self.run_python(('import sys, os;'
1661 'sys.exit(33 if os.getenv("FRUIT")=="banana" else 31)'),
1681 path = os.fsencode(sys.executable)
1682 args = [path, '-c', b'import sys; sys.exit(57)']
1688 path = FakePath(sys.executable)
1689 args = [path, '-c', 'import sys; sys.exit(57)']
1694 cp = self.run_python(("import sys;"
1695 "sys.stdout.write('BDFL'); "
1696 "sys.stderr.write('FLUFL')"),
1751 cp = subprocess.run([sys.executable, "-Xwarn_default_encoding", "-c", code],
1795 p = subprocess.Popen([sys.executable, "-c", ""],
1810 p = subprocess.Popen([sys.executable, "-c", ""],
1915 [sys.executable, "-c", "import os; print(os.getsid(0))"],
1933 [sys.executable, "-c", "import os; print(os.getpgid(0))"],
1951 name_uid = "nobody" if sys.platform != 'darwin' else "unknown"
1967 [sys.executable, "-c",
2015 [sys.executable, "-c",
2059 [sys.executable, "-c",
2060 "import os, sys, json; json.dump(os.getgroups(), sys.stdout)"],
2111 [sys.executable, "-c", f"open({name!r}, 'w').close()"],
2126 p = subprocess.Popen([sys.executable, "-c",
2155 p = subprocess.Popen([sys.executable, "-c",
2156 'import sys,os;'
2157 'sys.stdout.write(os.getenv("FRUIT"))'],
2167 p = subprocess.Popen([sys.executable, "-c", ""],
2225 subprocess.call([sys.executable, '-c', ''],
2232 subprocess.call([sys.executable, '-c', ''],
2240 sys.platform == 'darwin', 'setrlimit() seems to fail on OS X')
2253 subprocess.call([sys.executable, '-c', ''],
2267 fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
2268 sys.executable)
2278 [sys.executable, "-c",
2279 "import sys; sys.exit(47)"],
2282 [sys.executable, "-c",
2283 "import sys; sys.exit(47)"],
2312 fobj.write("exec '%s' -c 'import sys; sys.exit(47)'\n" %
2313 sys.executable)
2346 p = subprocess.Popen([sys.executable, "-c", """if 1:
2347 import sys, time
2348 sys.stdout.write('x\\n')
2349 sys.stdout.flush()
2364 @unittest.skipIf(sys.platform.startswith(('netbsd', 'openbsd')),
2369 p = subprocess.Popen([sys.executable, "-c", """if 1:
2370 import sys, time
2371 sys.stdout.write('x\\n')
2372 sys.stdout.flush()
2442 out, err = subprocess.Popen([sys.executable, "-c",
2443 'import sys;'
2444 'sys.stdout.write("apple");'
2445 'sys.stdout.flush();'
2446 'sys.stderr.write("orange")'],
2490 sys.executable, "-c",
2522 p = subprocess.Popen([sys.executable, "-c",
2523 'import sys; got = sys.stdin.read();'
2524 'sys.stdout.write("got %s"%got); sys.stderr.write("err")'],
2566 p = subprocess.Popen([sys.executable, "-c",
2567 'import sys; got = sys.stdin.read();'
2568 'sys.stdout.write("got %s"%got); sys.stderr.write("err")'],
2616 import os, sys
2617 skipped_fd = int(sys.argv[1])
2625 rc = subprocess.call([sys.executable, '-c', code, str(skipped_fd)],
2681 [sys.executable, "-c", script],
2692 [sys.executable, "-c", script],
2728 p1 = subprocess.Popen([sys.executable, sleeper],
2734 p2 = subprocess.Popen([sys.executable, fd_status],
2754 p1 = subprocess.Popen([sys.executable, qcat],
2758 p2 = subprocess.Popen([sys.executable, qgrep, subdata],
2805 p = subprocess.Popen([sys.executable, fd_status],
2813 p = subprocess.Popen([sys.executable, fd_status],
2825 p = subprocess.Popen([sys.executable, fd_status],
2836 @unittest.skipIf(sys.platform.startswith("freebsd") and
2854 p = subprocess.Popen([sys.executable, '-c', textwrap.dedent(
2856 import os, resource, subprocess, sys, textwrap
2879 sys.stdout.flush()
2892 [sys.executable, '-c',
2894 import subprocess, sys
2895 subprocess.Popen([sys.executable, %r] +
2934 p = subprocess.Popen([sys.executable, fd_status],
2962 args = [sys.executable, script]
2997 with subprocess.Popen([sys.executable, fd_status],
3031 p = subprocess.Popen([sys.executable, sigchild_ignore],
3042 p = subprocess.Popen([sys.executable, "-c",
3043 'import sys;'
3044 'sys.stdout.write("apple")'],
3060 p = subprocess.Popen([sys.executable, "-c",
3061 'import sys, time;'
3085 p = subprocess.Popen([sys.executable, "-c",
3130 p = subprocess.Popen([sys.executable, fd_status],
3243 proc = subprocess.Popen([sys.executable, '-h'],
3258 proc = subprocess.Popen([sys.executable, '-h'],
3309 p = subprocess.Popen([sys.executable, '-c', 'exit(1)'])
3321 proc = subprocess.Popen([sys.executable, '-c',
3396 sys.stderr.write(" a DOS box should flash briefly ...\n")
3397 subprocess.call(sys.executable +
3404 [sys.executable, "-c",
3405 "import sys; sys.exit(47)"],
3419 rc = subprocess.call([sys.executable, "-c",
3420 "import sys; sys.exit(47)"],
3436 p = subprocess.Popen([sys.executable, "-c",
3443 p = subprocess.Popen([sys.executable, "-c",
3454 p = subprocess.Popen([sys.executable, "-c",
3467 p = subprocess.Popen([sys.executable, "-c",
3520 rc = subprocess.call(sys.executable +
3521 ' -c "import sys; sys.exit(47)"')
3526 p = subprocess.Popen([sys.executable, "-c", """if 1:
3527 import sys, time
3528 sys.stdout.write('x\\n')
3529 sys.stdout.flush()
3546 p = subprocess.Popen([sys.executable, "-c", """if 1:
3547 import sys, time
3548 sys.stdout.write('x\\n')
3549 sys.stdout.flush()
3550 sys.exit(42)
3616 popener([sys.executable, "-c",
3617 "import time\ntime.sleep(9)\nimport sys\n"
3618 "sys.stderr.write('\\n!runaway child!\\n')"],
3706 os.write(f, b"import sys;"
3707 b"sys.stdout.write('%d %s' % (len(sys.argv), [a.lower () for a in sys.argv]))"
3726 self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname,
3731 self.with_spaces([sys.executable, self.fname, "ab cd"], shell=1)
3735 self.with_spaces('"%s" "%s" "%s"' % (sys.executable, self.fname,
3740 self.with_spaces([sys.executable, self.fname, "ab cd"])
3746 with subprocess.Popen([sys.executable, "-c",
3747 "import sys;"
3748 "sys.stdout.write('stdout');"
3749 "sys.stderr.write('stderr');"],
3759 with subprocess.Popen([sys.executable, "-c",
3760 "import sys; sys.exit(100)"]) as proc:
3766 with subprocess.Popen([sys.executable, "-c",
3767 "import sys;"
3768 "sys.exit(sys.stdin.read() == 'context')"],