-
Notifications
You must be signed in to change notification settings - Fork 384
Closed
Description
This is re: replicating an existing Fabric feature allowing users to insert their own stream objects to be used in place of the default writing to sys.std(out|err).
It's tougher here because while the "direct", non-pty-using use case isn't hard, pty use is currently difficult as we use pexpect right now and it's a reasonably gross, not written to be extended, etc.
There's a couple clear options:
- Try extending
pexpectanyway - the core spot that MUST be overridden isn't actually that long of a function and while it is__sekritthat still should be overrideable within a subclass.- Testing will still be gross but I've done most of the work for that already, so eh.
- Attempt to identify only the bits of
pexpectwe truly need, and replicate those in our own module (which can then be written to be more testable and of course, to have explicit stream control).- Going by the investigation I did for test mocking, it boils down to use of the stdlib
ptymodule, forking, runningos.execve, and thenselect.selecton the FDs involved. - Maybe not easy, and we'd lose (or eventually reimplement) a lot of the corner/edge cases that
pexpecthandles (such as lots of nasty Solaris stuff) - but maybe worthwhile?
- Going by the investigation I did for test mocking, it boils down to use of the stdlib