New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stream control in run() #235
Comments
I seriously recommend looking at the builtin
edit because I was curious, here's some stuff on |
~stalker~~~~ You haven't actually looked at how that stuff is implemented, huh? ;) We are using Also, in looking around I just found out somebody picked up But if I have to put that work in, yea, I may as well just see how little we can condense the useful bits via dropping |
Of generic note, in trying to mock out the I'd been wondering why the pty tests were SO much slower than the non-pty ones, since I'd been assuming most of the slow was the spawning of real subprocesses/shells. God bless This is what led to even more thoughts of extensibility, since that sleep value is defined via literal at instantiation time, and cannot be overridden at the module or class level - makes test-only overriding a PITA. |
Yeah, haven't looked at all the run implementation details - a huge chunk of picking
Totally, |
Honestly that's probably a good thing, since that is the point of such a tool! Anyway, I am poking at |
Neat, the pexpect work resulted in splitting out the PTY related stuff into https://github.com/pexpect/ptyprocess - may still be less extensible than we want, but good to see either way. Poking briefly. EDIT: It's a bit cleaner and has Unicode and Python 3 support, and explicitly drops a bunch of the legacy Solaris/etc junk. Unfortunately, the specific bits I would've had to override (some with copypasta), like the read loop & the init (re: sleep times) are still there. In fact, the read "loop" is actually gone and is just a straight up Think building our own module is sadly the "right" way to go here for testability/etc, I do not have the energy to try working with upstream to make things work right for my use case. At least we can still use pexpect/ptyprocess as a reference for edge/corner cases, and the "new" codebase is easier to read (it got a reformatting pass apparently) and Python 3 / Unicode compliant. Re: that stuff, the Will break it down and try to build it back up in a useful-to-us manner. |
On the way home I got a basic draft working based on This is without any of the apparently random assortment of tweaks Currently playing with refactoring, which shouldn't take too crazy long given how I wrote this (tho trying to keep |
Have been buried in a big arse refactor of Runner and related things now that the barrier between run_direct and run_local has been destroyed. Makes execution a lot more overridable/customizable and should still work for Remote, hopefully - will find out relatively soon. As a side benefit it has also helped me continue moving older, crappy, full-integration-style tests from one test module, into another one using mocking or the newly chopped-up class structure (testable code ❤️). |
|
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:
pexpect
anyway - the core spot that MUST be overridden isn't actually that long of a function and while it is__sekrit
that still should be overrideable within a subclass.pexpect
we 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).pty
module, forking, runningos.execve
, and thenselect.select
on the FDs involved.pexpect
handles (such as lots of nasty Solaris stuff) - but maybe worthwhile?The text was updated successfully, but these errors were encountered: