Fix status current-command

As it turns out, this just always printed "fish".

The solution here is a bit hacky as we go via the $_ variable.

Fixes #5339.
This commit is contained in:
Fabian Homborg
2018-11-14 12:12:03 +01:00
parent 278cbc5ff1
commit 1fffdbce79

View File

@@ -423,8 +423,15 @@ int builtin_status(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
}
case STATUS_CURRENT_CMD: {
CHECK_FOR_UNEXPECTED_STATUS_ARGS(opts.status_cmd)
streams.out.append(program_name);
streams.out.push_back(L'\n');
// HACK: Go via the deprecated variable to get the command.
const auto var = env_get(L"_");
if (!var.missing_or_empty()) {
streams.out.append(var->as_string());
streams.out.push_back(L'\n');
} else {
streams.out.append(program_name);
streams.out.push_back(L'\n');
}
break;
}
case STATUS_FISH_PATH: {