Windows doesn't like quotes around "edit" when calling it through system().

Even though that works fine on the command line.
This commit is contained in:
Guus Sliepen 2012-07-21 16:33:09 +02:00
parent 18237e1f2d
commit e5e96882c3

View file

@ -1461,14 +1461,12 @@ static int cmd_edit(int argc, char *argv[]) {
}
}
#ifndef HAVE_MINGW
char *editor = getenv("VISUAL") ?: getenv("EDITOR") ?: "vi";
#else
char *editor = "edit";
#endif
char *command;
xasprintf(&command, "\"%s\" \"%s\"", editor, filename);
#ifndef HAVE_MINGW
xasprintf(&command, "\"%s\" \"%s\"", getenv("VISUAL") ?: getenv("EDITOR") ?: "vi", filename);
#else
xasprintf(&command, "edit \"%s\"", filename);
#endif
int result = system(command);
if(result)
return result;