<type>documentation</type>
<domain>debug</domain>
<id>debug-process-i-o</id>
<title>Debug Process I/O</title>
<date>$Date$</date>
<version>$Revision$</version>
<product>all</product>

~~~if WING101:
Debug process output from ``print()`` or any writes to ``stdout`` or ``stderr`` appears in
the `Debug I/O <script:show_panel#panel_type="debug-io">`__ tool. This is also where you
enter keyboard input, if your debug program requests any with ``input()`` or by reading 
from ``stdin``.
~~~

~~~if not WING101: 
For a debug process launched from Wing, I/O associated with ``print()``, writing to
``stdout`` or ``stderr``, calls to ``input()``, or reads from ``stdin``, always occurs in 
the `Debug I/O <script:show_panel#panel_type="debug-io">`__ tool, unless an external 
console has been configured as described in `External I/O Consoles
<ref:debug/external-i-o-consoles>`__.

Debug processes launched outside of Wing, using ``wingdbstub``, always do I/O through the
environment from which they were launched, whether that's a console window, web server, or
any other I/O environment.

The code that services debug process I/O does two things: (1) any waits on ``sys.stdin``
are multiplexed with servicing of the debug network socket, so that the debug process
remains responsive to Wing even while waiting for keyboard input, and (2) if the debug
process was launched from Wing, I/O is redirected over the network to the IDE.

Multiplexing I/O can cause problems in some code.  See `Debug Process I/O 
Multiplexing <ref:debug/debug-i-o-multiplexing>`__ for details.
~~~

~~~if WINGPRO:
When commands are typed in the `Debug Console <ref:debug/debug-console>`__ in Wing
Pro, I/O is redirected temporarily to the ``Debug Console`` only during the time that the
command is being processed.
~~~
