Hi,
Here is another patch to improve a little bit the win32_spawn functions. It adds:
- GError support for the win32 functions (thanks to Jeff for the link!) - return code is now set on return - begin of time out support (30sec for sync)
The timeout is set to 30 secondbut it is not really required right now, the default behavior being to wait until that the process exists. The upcoming async support will use it more intensively (still some work, don't hold your breath :).
Cheers,
On Tue, 26 Feb 2008 20:10:24 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hi.
Here is another patch to improve a little bit the win32_spawn
Thanks a lot, Pierre.
functions. It adds:
- GError support for the win32 functions (thanks to Jeff for the link!)
I changed the usage a little bit to avoid memory leaks. g_win32_error_message() returns a newly-allocated buffer which needs to be freed. But not a big deal at all.
The timeout is set to 30 secondbut it is not really required right now, the default behavior being to wait until that the process exists. The upcoming async support will use it more intensively (still some work, don't hold your breath :).
Hehe, no need to hurry. It's done when it's done.
Attached is a patch which changes the used function for spawning commands in build.c for View DVI/PDF file and for the general Run command (e.g. execute a compiled C file or run a python script). But it shows that there must be a little bug whether in your code or in the code in build.c. I get these messages on the console: CreateChildProcess: CreateProcess failed win32_spawn: Create process failed utils_spawn_async() failed: Das System kann die angegebene Datei nicht finden.
(the German message at the end means: the system could not find the specified file)
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
(geany_run_script.bat actually existed and the above command line was executed as expected in a usually opened cmd.exe)
I didn't look depper into this problem. Maybe you'll find the problem.
Regards, Enrico
Hi Enrico,
On Wed, Feb 27, 2008 at 5:06 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
On Tue, 26 Feb 2008 20:10:24 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hi.
Here is another patch to improve a little bit the win32_spawn
Thanks a lot, Pierre.
functions. It adds:
- GError support for the win32 functions (thanks to Jeff for the link!)
I changed the usage a little bit to avoid memory leaks. g_win32_error_message() returns a newly-allocated buffer which needs to be freed. But not a big deal at all.
Thanks for this fix!
We need valgrind on windows or a VC build (there is some tools to work with VC binaries :).
The timeout is set to 30 secondbut it is not really required right now, the default behavior being to wait until that the process exists. The upcoming async support will use it more intensively (still some work, don't hold your breath :).
Hehe, no need to hurry. It's done when it's done.
Attached is a patch which changes the used function for spawning commands in build.c for View DVI/PDF file and for the general Run command (e.g. execute a compiled C file or run a python script). But it shows that there must be a little bug whether in your code or in the code in build.c. I get these messages on the console: CreateChildProcess: CreateProcess failed win32_spawn: Create process failed utils_spawn_async() failed: Das System kann die angegebene Datei nicht finden.
(the German message at the end means: the system could not find the specified file)
thanks :)
btw, I can read/speak German (write too but it is painful/slower ;).
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
(geany_run_script.bat actually existed and the above command line was executed as expected in a usually opened cmd.exe)
I didn't look depper into this problem. Maybe you'll find the problem.
I will take a quick look asap. If it is easily fixable, fine, if not I rather prefer to focus on the real async + io_add_watch implementation.
Off topic, where are you located in Germany? I'm wondering if we can have a drink, spring is coming early this year ;-)
Cheers,
On Wed, 27 Feb 2008 17:23:53 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hey,
[...] (the German message at the end means: the system could not find the specified file)
thanks :)
btw, I can read/speak German (write too but it is painful/slower ;).
Hehe and most of the other list members won't understand what we are talking about :D. We should keep it in English.
Off topic, where are you located in Germany? I'm wondering if we can
Let's move this into PM, I guess this isn't interesting for most users :D.
Regards, Enrico
Hi Enrico,
On Wed, Feb 27, 2008 at 5:06 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
(the German message at the end means: the system could not find the specified file)
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
Any reason to call it using cmd.exe and not directly?
On Wed, 27 Feb 2008 20:41:45 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hi Enrico,
On Wed, Feb 27, 2008 at 5:06 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
(the German message at the end means: the system could not find the specified file)
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
Any reason to call it using cmd.exe and not directly?
We need to execute the generated geany_run_script.bat, can we do this without explicitly calling cmd.exe?
Regards, Enrico
On Thu, Feb 28, 2008 at 9:59 AM, Enrico Tröger enrico.troeger@uvena.de wrote:
On Wed, 27 Feb 2008 20:41:45 +0100, "Pierre Joye"
pierre.php@gmail.com wrote:
Hi Enrico,
On Wed, Feb 27, 2008 at 5:06 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
(the German message at the end means: the system could not find the specified file)
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
Any reason to call it using cmd.exe and not directly?
We need to execute the generated geany_run_script.bat, can we do this without explicitly calling cmd.exe?
It should work yes. CreateProcess will actually do it in a cmd.exe like environment, using either the given env (to be done for windows) or the inherited one. I will debug your problem later this week and add some docs :)
On Thu, 28 Feb 2008 10:36:22 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
On Thu, Feb 28, 2008 at 9:59 AM, Enrico Tröger enrico.troeger@uvena.de wrote:
On Wed, 27 Feb 2008 20:41:45 +0100, "Pierre Joye"
pierre.php@gmail.com wrote:
Hi Enrico,
On Wed, Feb 27, 2008 at 5:06 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
(the German message at the end means: the system could not find the specified file)
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
Any reason to call it using cmd.exe and not directly?
We need to execute the generated geany_run_script.bat, can we do this without explicitly calling cmd.exe?
It should work yes. CreateProcess will actually do it in a cmd.exe like environment, using either the given env (to be done for windows) or the inherited one. I will debug your problem later this week and add some docs :)
Well, if calling the batch file works without the additional cmd.exe it would be even better. But is then still a console window opening? I think the console window can be useful when the user want to see stdout/stderr of the script/program he runs.
Regards, Enrico
On Wed, Feb 27, 2008 at 5:06 PM, Enrico Tröger enrico.troeger@uvena.de wrote:
On Tue, 26 Feb 2008 20:10:24 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
Hi.
Here is another patch to improve a little bit the win32_spawn
Thanks a lot, Pierre.
functions. It adds:
- GError support for the win32 functions (thanks to Jeff for the link!)
I changed the usage a little bit to avoid memory leaks. g_win32_error_message() returns a newly-allocated buffer which needs to be freed. But not a big deal at all.
The timeout is set to 30 secondbut it is not really required right now, the default behavior being to wait until that the process exists. The upcoming async support will use it more intensively (still some work, don't hold your breath :).
Hehe, no need to hurry. It's done when it's done.
Attached is a patch which changes the used function for spawning commands in build.c for View DVI/PDF file and for the general Run command (e.g. execute a compiled C file or run a python script). But it shows that there must be a little bug whether in your code or in the code in build.c. I get these messages on the console: CreateChildProcess: CreateProcess failed win32_spawn: Create process failed utils_spawn_async() failed: Das System kann die angegebene Datei nicht finden.
(the German message at the end means: the system could not find the specified file)
The created "cmdline" string looked good: C:\WINNT\System32\cmd.exe /Q /C G:\geany_run_script.bat
(geany_run_script.bat actually existed and the above command line was executed as expected in a usually opened cmd.exe)
I didn't look depper into this problem. Maybe you'll find the problem.
I'm not sure to understand how do you call the build. The win32 spawn actually uses the same environment than in a cmd.exe. You should be able to call a batch script (works here).
for spawning commands in build.c for View DVI/PDF file
How does it work? I mean where do you do that? :)
and for the general Run command (e.g. execute a compiled C file or run a python script).
Is it the "execute" menu and related options?
Cheers,
On Wed, 27 Feb 2008 20:57:16 +0100, "Pierre Joye" pierre.php@gmail.com wrote:
for spawning commands in build.c for View DVI/PDF file
How does it work? I mean where do you do that? :)
This isn't the easiest way, especially not on Windows. Since I don't have a working LaTeX installation on Windows, I just opened a LaTeX file and had a PDF file in the same directory as this file with the same basename(filename without extension). Then open this LaTeX file and choose Build->View PDF file. But using a script(PHP, Python, Perl, whatever) or a simple C programm to run is easier, see below.
and for the general Run command (e.g. execute a compiled C file or run a python script).
Is it the "execute" menu and related options?
Yes, easiest way to get there: File->New (with template)->C source file File->Save as Build->Build (or F9) Build->Execute (or F5)
then Geany creates a startup script called "geany_run_script.bat" which is executed. Then this script will execute the generated executable.
Regards, Enrico