mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
builtin status: remove spurious newline from current-command (Rust port regression)
WHen "status current-command" is called outside a function it always returns
"fish". An extra newline crept in, fix that.
Fixes 77aeb6a2a8 (Port execution, 2023-10-08).
Fixes #11503
This commit is contained in:
@@ -672,11 +672,10 @@ pub fn status(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> B
|
|||||||
STATUS_CURRENT_CMD => {
|
STATUS_CURRENT_CMD => {
|
||||||
let command = &parser.libdata().status_vars.command;
|
let command = &parser.libdata().status_vars.command;
|
||||||
if !command.is_empty() {
|
if !command.is_empty() {
|
||||||
streams.out.append(command);
|
streams.out.appendln(command);
|
||||||
} else {
|
} else {
|
||||||
streams.out.appendln(*PROGRAM_NAME.get().unwrap());
|
streams.out.appendln(*PROGRAM_NAME.get().unwrap());
|
||||||
}
|
}
|
||||||
streams.out.append_char('\n');
|
|
||||||
}
|
}
|
||||||
STATUS_CURRENT_COMMANDLINE => {
|
STATUS_CURRENT_COMMANDLINE => {
|
||||||
let commandline = &parser.libdata().status_vars.commandline;
|
let commandline = &parser.libdata().status_vars.commandline;
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ status --job-control=1none
|
|||||||
# Now set it to a valid mode.
|
# Now set it to a valid mode.
|
||||||
status job-control none
|
status job-control none
|
||||||
|
|
||||||
|
status current-command | sed s/^/^/
|
||||||
|
# CHECK: ^fish
|
||||||
|
|
||||||
# Check status -u outside functions
|
# Check status -u outside functions
|
||||||
status current-function
|
status current-function
|
||||||
#CHECK: Not a function
|
#CHECK: Not a function
|
||||||
|
|||||||
Reference in New Issue
Block a user