-
Notifications
You must be signed in to change notification settings - Fork 765
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
Core: Add launch function to call launch_subprocess only if multiprocessing is actually necessary #4237
Core: Add launch function to call launch_subprocess only if multiprocessing is actually necessary #4237
Conversation
… been loaded so stdin can function as expected on --nogui and similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested, code LGTM.
I'm a bit worried about the naming. Does anyone have problems with keeping a technically-wrong name for this new behaviour? |
to repeat what I mentioned in discord, |
I also dislike functions lieing to me. |
Was about to merge this, but I just realized that this now adds a function with wrong typing. For one, this is missing typing for Ts = TypeVarTuple("Ts")
def launch(f: Callable[[*Ts], Any], args: Tuple[*Ts] = ()) -> None:
f(*args) , the default Also there may be components that pass in a list[str] or a runtime-defined tuple rather than a fixed tuple? The other thing, which we should fix, is the type of |
For now, I'd lean towards merging as-is or with The Type Hint isn't wrong, it's just less useful than it could be. |
The thing about bare Callable is that is is underspecified, which is similar to being untyped, but has its own error in mypy --strict. So changing it to [..., Any] would be better, but this still can not check the call that is being made in the body. |
Bare callable is what launch_subprocess already used, if we want to fix both while we're here I have no issue applying whatever typing you land on, but blocking this over using typing we already use somewhere else seems silly |
This is how typing goes to sh!* 😁 The name was "critical" since it's a real error even with lax settings. The other one is just missing typing, basically. Partially-typed functions are not great, but we don't require full typing, so this can be solved later. Gonna review when i'm at PC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change should be safe since it's opt-in now. Tested CommonClient from button, command line, with and without --nogui and it behaves correctly.
Thanks!
What is this fixing or adding?
alternative to #3633 and making all clients that want similar handle it themselves
skips opening a new process if kivy (and thus the launcher gui) hasn't been loaded so stdin can function as expected on --nogui and similar
if there's a cleaner way to do this (even with a launcher rewrite) we should probably do that instead, but components seem pretty intentionally agnostic to if they're launched from the component arg handling or gui so I didn't really want to change thatFound a Util function to do the kivy check lolHow was this tested?
opened text client and bizhawk client with --nogui and could type commands just fine
opened launcher GUI and could open text client and close launcher without issue
launched messenger from url and could open text client from the popup and close the popup without issues
If this makes graphical changes, please attach screenshots.