Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 12 Jul 2015 14:46:47 UTC Commit: 290a80ab71773520d982486ce5f1c547e16793ed https://github.com/geany/geany/commit/290a80ab71773520d982486ce5f1c547e16793...
Log Message: ----------- Merge pull request #569 from b4n/spawn-wif-and-doc
Prefix the WIF* macros with SPAWN_ and add short doc comments, and fix Doxygen integration.
Modified Paths: -------------- doc/plugins.dox src/build.c src/search.c src/spawn.c src/spawn.h src/tools.c
Modified: doc/plugins.dox 1 lines changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -55,6 +55,7 @@ We will try to document as many functions and structs as possible. - @link msgwindow.h @endlink - @link project.h @endlink - @link sciwrappers.h Scintilla Wrapper Functions @endlink +- @link spawn.h Spawning programs @endlink - @link stash.h Stash Pref/Setting Functions @endlink - @link utils.h General Utility Functions @endlink - @link ui_utils.h Widget Utility Functions @endlink
Modified: src/build.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1042,7 +1042,7 @@ static void show_build_result_message(gboolean failure)
static void build_exit_cb(GPid child_pid, gint status, gpointer user_data) { - show_build_result_message(!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS); + show_build_result_message(!SPAWN_WIFEXITED(status) || SPAWN_WEXITSTATUS(status) != EXIT_SUCCESS); utils_beep();
build_info.pid = 0;
Modified: src/search.c 16 lines changed, 8 insertions(+), 8 deletions(-) =================================================================== @@ -1846,21 +1846,21 @@ static void search_read_io_stderr(GString *string, GIOCondition condition, gpoin static void search_finished(GPid child_pid, gint status, gpointer user_data) { const gchar *msg = _("Search failed."); -#ifdef G_OS_UNIX - gint exit_status = 1; + gint exit_status;
- if (WIFEXITED(status)) + if (SPAWN_WIFEXITED(status)) { - exit_status = WEXITSTATUS(status); + exit_status = SPAWN_WEXITSTATUS(status); } - else if (WIFSIGNALED(status)) + else if (SPAWN_WIFSIGNALED(status)) { exit_status = -1; g_warning("Find in Files: The command failed unexpectedly (signal received)."); } -#else - gint exit_status = status; -#endif + else + { + exit_status = 1; + }
switch (exit_status) {
Modified: src/spawn.c 8 lines changed, 6 insertions(+), 2 deletions(-) =================================================================== @@ -39,6 +39,10 @@ * This module does not depend on Geany when compiled for testing (-DSPAWN_TEST). */
+/** @file spawn.h + * Portable and convenient process spawning and communication. + */ + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -1164,8 +1168,8 @@ static void print_status(gint status) { fputs("finished, ", stderr);
- if (WIFEXITED(status)) - fprintf(stderr, "exit code %d\n", WEXITSTATUS(status)); + if (SPAWN_WIFEXITED(status)) + fprintf(stderr, "exit code %d\n", SPAWN_WEXITSTATUS(status)); else fputs("abnormal termination\n", stderr); }
Modified: src/spawn.h 9 lines changed, 6 insertions(+), 3 deletions(-) =================================================================== @@ -25,12 +25,15 @@ #include <glib.h>
#ifdef G_OS_WIN32 -# define WIFEXITED(status) TRUE -# define WEXITSTATUS(status) (status) -# define WIFSIGNALED(status) FALSE +# define SPAWN_WIFEXITED(status) TRUE +# define SPAWN_WEXITSTATUS(status) (status) +# define SPAWN_WIFSIGNALED(status) FALSE #else # include <sys/types.h> # include <sys/wait.h> +# define SPAWN_WIFEXITED(status) WIFEXITED(status) /**< non-zero if the child exited normally */ +# define SPAWN_WEXITSTATUS(status) WEXITSTATUS(status) /**< exit status of a child if exited normally */ +# define SPAWN_WIFSIGNALED(status) WIFSIGNALED(status) /**< non-zero if the child exited due to signal */ #endif
G_BEGIN_DECLS
Modified: src/tools.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -226,7 +226,7 @@ void tools_execute_custom_command(GeanyDocument *doc, const gchar *command) "Your selection was not changed. Error message: %s"), errors->str); } - else if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) + else if (!SPAWN_WIFEXITED(status) || SPAWN_WEXITSTATUS(status) != EXIT_SUCCESS) { /* TODO maybe include the exit code in the error message */ ui_set_statusbar(TRUE,
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).