diff options
author | Jeff King <peff@peff.net> | 2012-11-30 17:41:04 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-12-02 02:05:41 -0800 |
commit | f42ca31d8d209a43342ea345a52fc0bd43d71cc8 (patch) | |
tree | 3fa4332871deeae46e64b6dcc20efa12b04137b3 | |
parent | run-command: drop silent_exec_failure arg from wait_or_whine (diff) | |
download | tgif-f42ca31d8d209a43342ea345a52fc0bd43d71cc8.tar.xz |
launch_editor: refactor to use start/finish_command
The launch_editor function uses the convenient run_command_*
interface. Let's use the more flexible start_command and
finish_command functions, which will let us manipulate the
parent state while we're waiting for the child to finish.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | editor.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -37,8 +37,16 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en if (strcmp(editor, ":")) { const char *args[] = { editor, path, NULL }; + struct child_process p; - if (run_command_v_opt_cd_env(args, RUN_USING_SHELL, NULL, env)) + memset(&p, 0, sizeof(p)); + p.argv = args; + p.env = env; + p.use_shell = 1; + if (start_command(&p) < 0) + return error("unable to start editor '%s'", editor); + + if (finish_command(&p)) return error("There was a problem with the editor '%s'.", editor); } |