Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've successfully implemented an asynchronous, non-blocking prompt, which can simply extend our existing abstract prompt, leaving backwards compatibility unaffected. By using a
reactphp
event loop, I'm able to trigger renders and do other operations at any time since reading terminal input is no longer a blocking operation. This can almost certainly remove our reliance onforking
using theProcess Control
extension in theSpinner
class,and there's a slight chance that it could solve our Windows story (I still have to verify this, so don't quote me). It also happens to enable me to do some really cool stuff involving websockets that I'll have ready soon.However, none of that is in this PR.
This PR is exclusively to make my new feature compatible with Laravel Prompts irrespective of its ultimate home (I'm totally fine with it living in my
community prompts
package if that's what has to happen).self
tostatic
when setting or getting theConsoleOutput
object so that the$output
static property is set on the child.prompt
method which can now also be overridden in an extending class.Nothing
support class.Since the
while
loop is now a function, if we were to rely on returningnull
to continue looping, we could no longer returnnull
from any prompt. Sincenull
is a valid return value, I needed a way to, in effect, check for avoid
return.edit: I checked, and non-blocking i/o still wont work on Windows.