On Tue, 19 Feb 2008 02:44:40 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hi,
Then we add these wrapper functions to the plugin API just like any other function in Geany. So, plugins don't know anything about all the different handling, they just use Geany's utils_spawn_sync() and the correct code is executed by Geany.
The last paragraph is what I meant, create a wrapper around the OS specific functions and export it via the plugin API. My first attempt was to use the win32.c function directly.
With the plugin API you don't need any dllexports (what a luck :D).
Attached is an updated version, the changes are:
- Fixed bug when diffing a single file
- stderr support implemented (function sets now both stdout and stderr
- a couple of leaks and error checks
- a bit cleaner
I'll give it a try, thanks.
What I still have to do is:
- display errors using the various UI methods when necessary
Do it like you think it's good, or just use geany_debug() for now. This can be improved once the code itself is working.
- move the win32 codes to win32.c
- add utils_spawn_sync to the struct UtilsFuncs
You can also skip this and leave it to be done by me. No problem, it's just moving code.
I don't see a need of async call right now, I will implement sync only for now. However, on windows it will be async anyway, but I don't feel confortable enough with geany to go down the road of non blocking async IO for the plugins, maybe later :)
Hmmm, async process spawning is used inside Geany for the build commands. It's better to run compiler and make processes asynchronous to avoid a frozen GUI while waiting for the process to finish. If the process calling on Windows is always async, then it doesn't matter. The g_spawn_sync* calls in the vcdiff plugin were only because it is sufficient at this point(a svn diff doesn't take very long in usually) and the g_spawn_sync is just simpler to use.
But in Geany we need, or at least we want, the more sophisticated syntax of the async calls to read from the stdout and stderr pipes while the command is executed. Would this also be possible with your code? If not, it's not a big problem. This would only mean, when compiling some code on Windows inside Geany, the compiler output wouldn't be inserted "live" in the messages window but complete once the process finished.
Thank you very much for your efforts.
Regards, Enrico