On 16 July 2011 07:46, Josh Pschorr josh@pschorr.org wrote:
Hi, I ran into an issue using Geany on Windows where-in using either the build or compile commands to kick off a custom script caused Geany to hang for about a minute, after which it returned and the compiler log showed only a fraction of the output it should. After tracking this down, it seems that on Windows, a custom spawn function is used in build_spawn_cmd and rather than g_spawn_async_with_pipes, utils_spawn_sync which ends up calling win32_spawn. win32_spawn would set up pipes for stdout and stderr (using default buffer size), kick off the a child process, wait for it finish, and finally dump the stdout/stderr pipes to a temp file and then read that into memory. if the process didn't exit after a minute, it was forcefully killed. The problem seems to be that pipes are only 4kb buffered by default, so any process needing to write more than this would block while writing to stdout and Geany would kill it, as it wasn't reading the pipes until after the process exited. The attached patch fixes this such that the pipes are read and dumped to the temp file continuously as the child process runs. Now the child process will be forcibly killed only if it doesn't write to one of its pipes for at least 30 seconds.
Out of curiosity, why isn't g_spawn_async_with_pipes used on Windows? It seems to work with some degree of success for the grep command (as used by search_find_in_files), albeit without completion status reporting.
Regards, Josh Pschorr
For background see http://lists.uvena.de/geany-devel/2009-April/000584.html and associated messages.
Cheers Lex
Geany-devel mailing list Geany-devel@uvena.de https://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel