Handle arguments in $EDITOR

Fixes #2079.
This commit is contained in:
Eelco Dolstra 2018-04-17 12:16:04 +02:00
parent c74f838620
commit a4aac7f88c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -61,7 +61,7 @@ struct CmdEdit : InstallableCommand
auto editor = getEnv("EDITOR", "cat");
Strings args{editor};
auto args = tokenizeString<Strings>(editor);
if (editor.find("emacs") != std::string::npos ||
editor.find("nano") != std::string::npos ||
@ -72,7 +72,7 @@ struct CmdEdit : InstallableCommand
stopProgressBar();
execvp(editor.c_str(), stringsToCharPtrs(args).data());
execvp(args.front().c_str(), stringsToCharPtrs(args).data());
throw SysError("cannot run editor '%s'", editor);
}