Revision: 2344 http://geany.svn.sourceforge.net/geany/?rev=2344&view=rev Author: eht16 Date: 2008-03-14 09:59:36 -0700 (Fri, 14 Mar 2008)
Log Message: ----------- Add win32_get_exit_status() to retrieve the exit code from a command on Windows.
Modified Paths: -------------- trunk/ChangeLog trunk/src/build.c trunk/src/win32.c trunk/src/win32.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-03-14 16:19:53 UTC (rev 2343) +++ trunk/ChangeLog 2008-03-14 16:59:36 UTC (rev 2344) @@ -9,6 +9,9 @@ * src/Makefile.am: Add prefs.h to the list of installed header files. * src/win32.c: Fix crashes on Windows when error argument of utils_spawn_* is NULL. + * src/build.c, src/win32.c, src/win32.h: + Add win32_get_exit_status() to retrieve the exit code from a + command on Windows (code moved from build.c).
2008-03-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/build.c =================================================================== --- trunk/src/build.c 2008-03-14 16:19:53 UTC (rev 2343) +++ trunk/src/build.c 2008-03-14 16:59:36 UTC (rev 2344) @@ -55,6 +55,7 @@ #include "vte.h" #include "project.h" #include "editor.h" +#include "win32.h"
BuildInfo build_info = {GBO_COMPILE, 0, NULL, GEANY_FILETYPES_ALL, NULL}; @@ -1027,11 +1028,7 @@ } show_build_result_message(failure); #else - DWORD exit_code; - GetExitCodeProcess(child_pid, &exit_code); - /* not sure whether the cast to int is necessary, no idea what DWORD really is - * (seems to be similar to an int) */ - show_build_result_message((int) exit_code); + show_build_result_message(! win32_get_exit_status(child_pid)); #endif
utils_beep();
Modified: trunk/src/win32.c =================================================================== --- trunk/src/win32.c 2008-03-14 16:19:53 UTC (rev 2343) +++ trunk/src/win32.c 2008-03-14 16:59:36 UTC (rev 2344) @@ -638,6 +638,17 @@ }
+/* Returns TRUE if the command, which child_pid refers to, returned with a successful exit code, + * otherwise FALSE. */ +gboolean win32_get_exit_status(GPid child_pid) +{ + DWORD exit_code; + GetExitCodeProcess(child_pid, &exit_code); + + return (exit_code == 0); +} + + static void debug_setup_console() { static const WORD MAX_CONSOLE_LINES = 500;
Modified: trunk/src/win32.h =================================================================== --- trunk/src/win32.h 2008-03-14 16:19:53 UTC (rev 2343) +++ trunk/src/win32.h 2008-03-14 16:59:36 UTC (rev 2344) @@ -54,6 +54,8 @@
gchar *win32_get_hostname();
+gboolean win32_get_exit_status(GPid child_pid); + gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags flags, gchar **std_out, gchar **std_err, gint *exit_status, GError **error);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.