aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-05-10 09:12:26 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-05-10 09:12:26 +0800
commit409f147b81748829457ee9110ccd0488ad9bfbf4 (patch)
tree4e50e87f2ac1b3c27a823357052adc036999ebb1
parent593b9aec6c0590e725176f9725a9083133d70c4e (diff)
downloadgsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.tar
gsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.tar.gz
gsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.tar.bz2
gsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.tar.lz
gsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.tar.xz
gsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.tar.zst
gsoc2013-evolution-409f147b81748829457ee9110ccd0488ad9bfbf4.zip
New filter function to pipe a message to another program. (run_command):
2002-05-09 Jeffrey Stedfast <fejj@ximian.com> * camel-filter-search.c (shell_exec): New filter function to pipe a message to another program. (run_command): Fixed some bugs to make this work. svn path=/trunk/; revision=16742
-rw-r--r--camel/ChangeLog1
-rw-r--r--camel/camel-filter-search.c19
2 files changed, 7 insertions, 13 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 146e635d65..4b87d56e95 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -2,6 +2,7 @@
* camel-filter-search.c (shell_exec): New filter function to pipe
a message to another program.
+ (run_command): Fixed some bugs to make this work.
2002-05-09 Not Zed <NotZed@Ximian.com>
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index a217aeed57..02362b7e2b 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -546,12 +546,13 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa
}
args = g_ptr_array_new ();
- for (i = 0; i < argc; i++) {
+ g_ptr_array_add (args, g_basename (argv[0]->value.string));
+ for (i = 1; i < argc; i++) {
g_ptr_array_add (args, argv[i]->value.string);
}
g_ptr_array_add (args, NULL);
- execvp (argv[i]->value.string, (char **) args->pdata);
+ execvp (argv[0]->value.string, (char **) args->pdata);
g_ptr_array_free (args, TRUE);
@@ -573,16 +574,8 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa
message = camel_filter_search_get_message (fms, f);
- if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream) == -1 ||
- camel_stream_flush (stream) == -1) {
- if (errno == EINTR)
- camel_exception_set (fms->ex, CAMEL_EXCEPTION_USER_CANCEL, "User Cancelled");
- else
- camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to write message to '%s': %s"),
- argv[0]->value.string, g_strerror (errno));
- }
-
+ camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
+ camel_stream_flush (stream);
camel_object_unref (CAMEL_OBJECT (stream));
result = waitpid (pid, &status, 0);
@@ -600,7 +593,7 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa
}
}
- if (!camel_exception_is_set (fms->ex) && result != -1 && WIFEXITED (status))
+ if (result != -1 && WIFEXITED (status))
return WEXITSTATUS (status);
else
return -1;