MCPcopy Index your code
hub / github.com/RustPython/RustPython / child

Method child

Lib/test/test_builtin.py:2650–2663  ·  view source on GitHub ↗
(wpipe)

Source from the content-addressed store, hash-verified

2648 if not sys.stdin.isatty() or not sys.stdout.isatty():
2649 self.skipTest("stdin and stdout must be ttys")
2650 def child(wpipe):
2651 # Check the error handlers are accounted for
2652 if stdio_encoding:
2653 sys.stdin = io.TextIOWrapper(sys.stdin.detach(),
2654 encoding=stdio_encoding,
2655 errors=stdin_errors)
2656 sys.stdout = io.TextIOWrapper(sys.stdout.detach(),
2657 encoding=stdio_encoding,
2658 errors=stdout_errors)
2659 print("tty =", sys.stdin.isatty() and sys.stdout.isatty(), file=wpipe)
2660 try:
2661 print(ascii(input(prompt)), file=wpipe)
2662 except BaseException as e:
2663 print(ascii(f'{e.__class__.__name__}: {e!s}'), file=wpipe)
2664 with self.detach_readline():
2665 lines = self.run_child(child, terminal_input + b"\r\n")
2666 # Check we did exercise the GNU readline path

Calls 6

asciiFunction · 0.85
printFunction · 0.50
inputFunction · 0.50
detachMethod · 0.45
isattyMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected