-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Make stdio a feature #5420
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
Make stdio a feature #5420
Conversation
When embedding RustPython into a graphical windows application (where windows_subsystem = "windows"), it fails to create the RustPython VM. This happens because the VM will try to open stdin/stdout/stderr when initializing, but stdio isn't available for /SUBSYSTEM:WINDOWS apps. This commit makes stdio a feature, so it can be disabled when needed. https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute https://learn.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem?view=msvc-170 https://asawicki.info/news_1768_ways_to_print_and_capture_text_output_of_a_process
Probably a better solution would be to implement the |
Although for now, this is probably blocking you, so a feature flag is fine. Could you make it an off-by-default |
Since |
It makes sense, but wouldn't it make it mandatory to create a console to run the VM? I guess we could go to this route, which would fix using RustPython with win32 GUI apps, but I think it would still be nice to have a feature to control if we want a console to be created. For us, at least, we don't want the user to see the console, as the python code is only used to embed dynamic logic inside our app. I'm open to do any changes you guys find necessary! |
e8d8474
to
28b97b9
Compare
More in line with what CPython does
@coolreader18 could you follow this up? I am not good at windows dev |
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.
Sorry for the long delay. This seems reasonable to me; thank you!
Did a manual squash-merge (dabd93c) - sorry again for the delay! |
When embedding RustPython into a graphical windows application (where windows_subsystem = "windows"), it fails to create the RustPython VM.
This happens because the VM will try to open stdin/stdout/stderr when initializing, but stdio isn't available for /SUBSYSTEM:WINDOWS apps.
This commit makes stdio a feature, so it can be disabled when needed.
https://doc.rust-lang.org/reference/runtime.html#the-windows_subsystem-attribute
https://learn.microsoft.com/en-us/cpp/build/reference/subsystem-specify-subsystem?view=msvc-170 https://asawicki.info/news_1768_ways_to_print_and_capture_text_output_of_a_process