aboutsummaryrefslogtreecommitdiff
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
parentab3ac6f4017a03390084d9293df4b7ce126f4572 (diff)
replaced popen() with GSpawn.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@289 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--ChangeLog.ja5
-rw-r--r--src/utils.c23
3 files changed, 16 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index bb96bc10..5a3dc317 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2005-05-25
+ * src/utils.c: get_command_output(): use g_spawn_command_line_sync()
+ instead of popen().
+
+2005-05-25
+
* src/send_message.c: send_message_local(): use GSpawn, and detect
errors.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index d6cf5312..234c7173 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,10 @@
2005-05-25
+ * src/utils.c: get_command_output(): popen() でなく
+ g_spawn_command_line_sync() を使用するようにした。
+
+2005-05-25
+
* src/send_message.c: send_message_local(): GSpawn を使用し、エラー
を検出するようにした。
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)