mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 15:14:44 +00:00
run_command_list to stop accepting its commands by pointer
There was no reason for this. No functional change here.
This commit is contained in:
parent
0230420983
commit
f19a2711d4
1 changed files with 5 additions and 8 deletions
13
src/fish.cpp
13
src/fish.cpp
|
@ -253,9 +253,9 @@ static void read_init(parser_t &parser, const struct config_paths_t &paths) {
|
|||
}
|
||||
}
|
||||
|
||||
static int run_command_list(parser_t &parser, std::vector<std::string> *cmds,
|
||||
static int run_command_list(parser_t &parser, const std::vector<std::string> &cmds,
|
||||
const io_chain_t &io) {
|
||||
for (const auto &cmd : *cmds) {
|
||||
for (const auto &cmd : cmds) {
|
||||
wcstring cmd_wcs = str2wcstring(cmd);
|
||||
// Parse into an ast and detect errors.
|
||||
parse_error_list_t errors;
|
||||
|
@ -274,8 +274,6 @@ static int run_command_list(parser_t &parser, std::vector<std::string> *cmds,
|
|||
wcstring sb;
|
||||
parser.get_backtrace(cmd_wcs, errors, sb);
|
||||
std::fwprintf(stderr, L"%ls", sb.c_str());
|
||||
// Note: We do not return here because that's how it historically worked.
|
||||
// return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,8 +518,7 @@ int main(int argc, char **argv) {
|
|||
// If we have no config, we default to the default key bindings.
|
||||
parser.vars().set_one(L"fish_key_bindings", ENV_UNEXPORT, L"fish_default_key_bindings");
|
||||
if (function_exists(L"fish_default_key_bindings", parser)) {
|
||||
std::vector<std::string> cmd{"fish_default_key_bindings"};
|
||||
run_command_list(parser, &cmd, {});
|
||||
run_command_list(parser, {"fish_default_key_bindings"}, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -545,7 +542,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
// Run post-config commands specified as arguments, if any.
|
||||
if (!opts.postconfig_cmds.empty()) {
|
||||
res = run_command_list(parser, &opts.postconfig_cmds, {});
|
||||
res = run_command_list(parser, opts.postconfig_cmds, {});
|
||||
}
|
||||
|
||||
if (!opts.batch_cmds.empty()) {
|
||||
|
@ -563,7 +560,7 @@ int main(int argc, char **argv) {
|
|||
list.push_back(str2wcstring(*ptr));
|
||||
}
|
||||
parser.vars().set(L"argv", ENV_DEFAULT, std::move(list));
|
||||
res = run_command_list(parser, &opts.batch_cmds, {});
|
||||
res = run_command_list(parser, opts.batch_cmds, {});
|
||||
parser.libdata().exit_current_script = false;
|
||||
} else if (my_optind == argc) {
|
||||
// Implicitly interactive mode.
|
||||
|
|
Loading…
Reference in a new issue