Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

process_stdinreader.py 739B

1 year ago
12345678910111213141516171819202122232425262728293031323334
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Script used by twisted.test.test_process on win32.
  5. """
  6. import msvcrt
  7. import os
  8. import sys
  9. msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) # type:ignore[attr-defined]
  10. msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) # type:ignore[attr-defined]
  11. # We want to write bytes directly to the output, not text, because otherwise
  12. # newlines get mangled. Get the underlying buffer.
  13. stdout = sys.stdout.buffer
  14. stderr = sys.stderr.buffer
  15. stdin = sys.stdin.buffer
  16. stdout.write(b"out\n")
  17. stdout.flush()
  18. stderr.write(b"err\n")
  19. stderr.flush()
  20. data = stdin.read()
  21. stdout.write(data)
  22. stdout.write(b"\nout\n")
  23. stderr.write(b"err\n")
  24. sys.stdout.flush()
  25. sys.stderr.flush()