pixi icon indicating copy to clipboard operation
pixi copied to clipboard

fix: Attach to the console on Windows

Open certik opened this issue 1 year ago • 3 comments

This makes std::cout working again after switching to a GUI application in https://github.com/prefix-dev/pixi/pull/2067. It still does not open a console when launched from the Windows Explorer, but when launched from a terminal, it will now print to the terminal again, as before.

certik avatar Sep 17 '24 20:09 certik

I tested on Windows natively (in a shell) and on Linux (in WSL) and it works for me in both.

certik avatar Sep 17 '24 21:09 certik

This seems rather complex for an example. Is this worth having the ability to start the built executable from outside pixi?

Instead of std::cout we could also use https://wiki.libsdl.org/SDL2/SDL_ShowSimpleMessageBox perhaps?

baszalmstra avatar Sep 18 '24 05:09 baszalmstra

The std::cout is used for error messages if SDL cannot be initialized, so probably we can't use SDL itself to show the error.

Yes, it's quite complex, so maybe not worth doing. This seems to be the right approach to get it fully working on Windows, so I posted it here.

Regarding the ability to start outside of pixi, I would say that depends on what the goal of pixi is: is it supposed to create standalone executables that run on their own, or is the goal to always require pixi to setup the proper environment?

certik avatar Sep 18 '24 06:09 certik

I think the goal of this example is more to show of the task caching and the ablity to build cpp in pixi environments. We don't have to go indepth on these "applications" themself.

Thanks for your input @certik, I'll close the PR for now.

ruben-arts avatar Oct 07 '24 09:10 ruben-arts