aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-05-25 08:59:29 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-05-25 08:59:29 +0000
commit67d6c453ec8126739d9588cf35bca3a5293a95fb (patch)
tree03a73348f5c294765a1b952b0900b89fda586ed6 /src
parentab3ac6f4017a03390084d9293df4b7ce126f4572 (diff)
replaced popen() with GSpawn.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@289 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/utils.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/utils.c b/src/utils.c
index 8fb7cc3d..3a931b44 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -2944,29 +2944,18 @@ gint execute_command_line(const gchar *cmdline, gboolean async)
gchar *get_command_output(const gchar *cmdline)
{
- gchar buf[BUFFSIZE];
- FILE *fp;
- GString *str;
- gchar *ret;
+ gchar *child_stdout;
+ gint status;
g_return_val_if_fail(cmdline != NULL, NULL);
- if ((fp = popen(cmdline, "r")) == NULL) {
- FILE_OP_ERROR(cmdline, "popen");
+ if (g_spawn_command_line_sync(cmdline, &child_stdout, NULL, &status,
+ NULL) == FALSE) {
+ g_warning("Can't execute command: %s\n", cmdline);
return NULL;
}
- str = g_string_new("");
-
- while (fgets(buf, sizeof(buf), fp) != NULL)
- g_string_append(str, buf);
-
- pclose(fp);
-
- ret = str->str;
- g_string_free(str, FALSE);
-
- return ret;
+ return child_stdout;
}
gint open_uri(const gchar *uri, const gchar *cmdline)