Re: Bug: git-p4 edit_template() and P4EDITOR w/options
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:04:39
Junio C Hamano [off-list ref] writes:
The relevant part of git-p4 is this:
# invoke the editor
if os.environ.has_key("P4EDITOR") and (os.environ.get("P4EDITOR") != ""):
editor = os.environ.get("P4EDITOR")
else:
editor = read_pipe("git var GIT_EDITOR").strip()
system([editor, template_file])
It grabs $EDITOR (or $GIT_EDITOR) and treats it as the path to the
editor executable, without letting shell to split that into words at
whitespace boundaries, so that you can say things like
EDITOR="/User/me/My Programs/nano"
The way we spawn EDITOR in our core codepaths matches what git-p4
does, too:
const char *args[] = { editor, real_path(path), NULL };
struct child_process p = CHILD_PROCESS_INIT;
int ret, sig;
p.argv = args;
p.env = env;
p.use_shell = 1;
if (start_command(&p) < 0)
return error("unable to start editor '%s'", editor);
...
So...Well, I'll take that back. I misread p.use_shell line.