aboutsummaryrefslogtreecommitdiff
path: root/libsylph/utils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-31 10:37:15 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-10-31 10:37:15 +0000
commit378b0cef0f72b3f761bfb3e8b1707d02d0d0eba9 (patch)
tree3cd93100937846153033313000954a3886b6720b /libsylph/utils.c
parent2e8bbf72a5a7534714348eae0fbf52d539f2934a (diff)
execute_sync(): win32: get exit status of child process by not using helper program.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@700 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r--libsylph/utils.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 0ad23c3a..b6c41e12 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -3111,19 +3111,27 @@ gint execute_sync(gchar *const argv[])
g_return_val_if_fail(argv != NULL && argv[0] != NULL, -1);
+#ifdef G_OS_WIN32
+ if (g_spawn_sync(NULL, (gchar **)argv, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_CHILD_INHERITS_STDIN |
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
+ NULL, NULL, NULL, NULL, &status, NULL) == FALSE) {
+ g_warning("Can't execute command: %s\n", argv[0]);
+ return -1;
+ }
+
+ return status;
+#else
if (g_spawn_sync(NULL, (gchar **)argv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL, &status, NULL) == FALSE) {
g_warning("Can't execute command: %s\n", argv[0]);
return -1;
}
-#ifdef G_OS_UNIX
if (WIFEXITED(status))
return WEXITSTATUS(status);
else
return -1;
-#else
- return status;
#endif
}