This represents porting Fabric 1.x's limited ability to autorespond to sudo prompts, to Invoke, and making it Better™.
For now, I've gone with a basic "when you see X, always respond with Y" functionality that can be easily configured via a {pattern: response} dict.
This isn't the most powerful implementation; e.g. one might want "only respond to patterns once", "respond to X pattern the first 3 times only", "respond to pattern X but only if you've already responded to pattern Y", etc etc.
However it's arguably more flexible than using e.g. pexpect (which requires you to anticipate exactly what prompts will happen, in what order; Invoke/Fabric use cases tend to have prompts appear arbitrarily) and I expect it will be enhanced in the future, perhaps by ripping out the responder aspects into their own class or something.
The functionality is already pretty much complete after a ~week of hacking, fucking up, getting confused, becoming less confused, and more hacking. I'm making this ticket just so I have something to link in the changelog & a checklist for the random minor tasks left to perform.
Left to do:
This represents porting Fabric 1.x's limited ability to autorespond to sudo prompts, to Invoke, and making it Better™.
For now, I've gone with a basic "when you see X, always respond with Y" functionality that can be easily configured via a
{pattern: response}dict.This isn't the most powerful implementation; e.g. one might want "only respond to patterns once", "respond to X pattern the first 3 times only", "respond to pattern X but only if you've already responded to pattern Y", etc etc.
However it's arguably more flexible than using e.g.
pexpect(which requires you to anticipate exactly what prompts will happen, in what order; Invoke/Fabric use cases tend to have prompts appear arbitrarily) and I expect it will be enhanced in the future, perhaps by ripping out the responder aspects into their own class or something.The functionality is already pretty much complete after a ~week of hacking, fucking up, getting confused, becoming less confused, and more hacking. I'm making this ticket just so I have something to link in the changelog & a checklist for the random minor tasks left to perform.
Left to do:
handle_input, which mirrors real stdin to the subprocess' stdin.getchas per Handle stdin on Windows using msvcrt functions #304 (comment)sleepcall inhandle_input; git-blame the Fab 1 line and doublecheck the rationale. Probably do want it back tho, probably chews more CPU than it really needs to as-is.raw_inputandgetpass? Cuz if it can then that implies said halting/locking might not have been necessary? Or is a corner case?runcontext) #274 and its linked tickets\nto response values if not present" feature.\nmultiple times already, so there's no way tons of users wouldn't make the same assumption.