stdio.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- test-case-name: twisted.test.test_stdio -*-
  2. # Copyright (c) Twisted Matrix Laboratories.
  3. # See LICENSE for details.
  4. """
  5. Standard input/out/err support.
  6. This module exposes one name, StandardIO, which is a factory that takes an
  7. IProtocol provider as an argument. It connects that protocol to standard input
  8. and output on the current process.
  9. It should work on any UNIX and also on Win32 (with some caveats: due to
  10. platform limitations, it will perform very poorly on Win32).
  11. Future Plans::
  12. support for stderr, perhaps
  13. Rewrite to use the reactor instead of an ad-hoc mechanism for connecting
  14. protocols to transport.
  15. Maintainer: James Y Knight
  16. """
  17. from __future__ import absolute_import, division
  18. from twisted.python.runtime import platform
  19. if platform.isWindows():
  20. from twisted.internet import _win32stdio
  21. StandardIO = _win32stdio.StandardIO
  22. PipeAddress = _win32stdio.Win32PipeAddress
  23. else:
  24. from twisted.internet._posixstdio import StandardIO, PipeAddress
  25. __all__ = ['StandardIO', 'PipeAddress']