On Sat, 23 Feb 2008 18:57:41 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hi,
Changes:
- renamed geany_w32_spawn_sync in win32_spawn
- added utils_spawn_async() which calls g_spawn_async() on non-Win32
systems, else it calls win32_spawn (for now)
- added GError argument to utils_spawn_* functions
What does it do on windows? We may add getLastError and create a GError from its content (have to see what exactly is a GError :)
At the moment, it only creates a GError object with a general error message. But maybe we could indeed use the GetLastError() function. I guess we have to use FormatMessage to get an error string from it, right? I had a short look and at the moment I'm not sure how to use it. What exactly is a LPTSTR and can it be converted into a char* ? Anyway, using the GError system has two advantages: - we don't have to rewrite existing code which relies on that the given error argument is set if an error occurred - we can use the already existing way of error reporting
- made helper functions in win32.c static
- some little coding style changes, just cosmetics
Questions: You told win32_spawn() always creates processes asynchronous? If so, it should be ok to use it for g_spawn_sync and g_spawn_async calls, right? I must admit I didn't test the code much, yet.
on Windows? They don't work in a reliable way, that's the problem. But
I'm a little confused. The current code works synchronous with the calling process(geany)? This is what I'm experiencing (at least I think so, hard to say on an emulated Windows in VirtualBox :D). But I thought you have said on Windows spawned processes are asynchronous?
Do you think it's possible to create g_spawn_async_with_pipes() on Windows?
It is possible yes, I use a similar solution already to fetch the content. It uses pipes for the stdin/out/err.
If it would require too much work, too mch code or isn't realisable at all(for whatever reasion), it might be ok to fake the pipes by running the process, when it is finished we grab the output on stdout and feed it completely to the pipe to which is Geany listing. This would cause Geany's GUI to freeze while the command is running but at least it would work.
Regards, Enrico