[Twisted-Python] _dumbwin32proc and PIPE_NOWAIT

Manlio Perillo manlio_perillo at libero.it
Sat Oct 7 18:02:50 EDT 2006

glyph at divmod.com ha scritto:
> [...]

>> Here is the main code.
>> I suspect such a thing will never be accepted into Twisted ;-):
> As JP said, it might, with some tests and a patch in the tracker :).
>> The _win32stdio module can simply check if the stdin is attached to a
>> terminal, so it (hopefully) can support both pipes and consoles.
> That would be great.

I have managed to have an acceptable solution:

>> Many things can be added, like an emulation of POSIX terminal, callbacks
>> for resize events, support for focus in/out, colored output, history
>> editing, ...
>> [1]
>> How can be tested such a thing?
> In addition to JP's suggestion, "mock" the actual API you will be
> testing with, by replacing it in the tests and asserting that the
> appropriate things are called on the console object that you are passing
> it.
> Both approaches make sense in different situations, and good test
> coverage will generally do both.

For now in the test suit I simply put some characters in the console
input buffer (with WriteConsoleInput), checking that they are
read/handled correctly.

I think that this should suffice.

If this patch is accepted I will add a new module,
twisted.internet.termios, for a portable termios support (to be used by
conch script).

My implementation supports raw mode and adding a callback when the
window size changes.
In future I will add history editing (as it works in cmd.exe)

Regards  Manlio Perillo

More information about the Twisted-Python mailing list