1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 06:52:43 +01:00

Handle arguments in $EDITOR

Fixes #2079.

(cherry picked from commit a4aac7f88c)
This commit is contained in:
Eelco Dolstra 2018-04-17 12:16:04 +02:00
parent 5be4f48c2d
commit b1ade66815
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"); auto editor = getEnv("EDITOR", "cat");
Strings args{editor}; auto args = tokenizeString<Strings>(editor);
if (editor.find("emacs") != std::string::npos || if (editor.find("emacs") != std::string::npos ||
editor.find("nano") != std::string::npos || editor.find("nano") != std::string::npos ||
@ -72,7 +72,7 @@ struct CmdEdit : InstallableCommand
stopProgressBar(); stopProgressBar();
execvp(editor.c_str(), stringsToCharPtrs(args).data()); execvp(args.front().c_str(), stringsToCharPtrs(args).data());
throw SysError("cannot run editor '%s'", editor); throw SysError("cannot run editor '%s'", editor);
} }