diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2015-01-16 11:48:50 +0100 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2015-01-16 09:21:30 -0500 |
commit | ce957f864907e665591e02455ed87f70d3ebe930 (patch) | |
tree | aeff04e65a27a38722e7548420519cc3b4e995ce | |
parent | f2ae405f9f9658cb2252b4cbcc12f222530bcc92 (diff) | |
download | ostree-ce957f864907e665591e02455ed87f70d3ebe930.tar.gz |
editor: honor arguments environment variable
My EDITOR looks like "EDITOR=emacs -nw", ensure that it is honored.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r-- | src/ostree/ot-editor.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ostree/ot-editor.c b/src/ostree/ot-editor.c index e1ca1a18..608c58b6 100644 --- a/src/ostree/ot-editor.c +++ b/src/ostree/ot-editor.c @@ -68,6 +68,7 @@ ot_editor_prompt (OstreeRepo *repo, GOutputStream *output; const char *editor; char *ret = NULL; + gs_free gchar *args = NULL; editor = get_editor (); if (editor == NULL) @@ -86,7 +87,11 @@ ot_editor_prompt (OstreeRepo *repo, !g_io_stream_close (G_IO_STREAM (io), cancellable, error)) goto out; - ctx = gs_subprocess_context_newv (editor, gs_file_get_path_cached (file), NULL); + { + gs_free gchar *quoted_file = g_shell_quote (gs_file_get_path_cached (file)); + args = g_strconcat (editor, " ", quoted_file, NULL); + } + ctx = gs_subprocess_context_newv ("/bin/sh", "-c", args, NULL); gs_subprocess_context_set_stdin_disposition (ctx, GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT); gs_subprocess_context_set_stdout_disposition (ctx, GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT); gs_subprocess_context_set_stderr_disposition (ctx, GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT); |