mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 16:51:15 -03:00
@@ -46,6 +46,15 @@ maybe_t<int> builtin_cd(parser_t &parser, io_streams_t &streams, const wchar_t *
|
||||
dir_in = maybe_dir_in->as_string();
|
||||
}
|
||||
|
||||
if (dir_in.empty()) {
|
||||
streams.err.append_format(_(L"%ls: Empty directory '%ls' does not exist\n"), cmd,
|
||||
dir_in.c_str());
|
||||
|
||||
if (!parser.is_interactive()) streams.err.append(parser.current_line());
|
||||
|
||||
return STATUS_CMD_ERROR;
|
||||
}
|
||||
|
||||
wcstring pwd = parser.vars().get_pwd_slash();
|
||||
auto dirs = path_apply_cdpath(dir_in, pwd, parser.vars());
|
||||
if (dirs.empty()) {
|
||||
|
||||
@@ -218,3 +218,13 @@ __fish_test_thrash_cd |
|
||||
__fish_test_thrash_cd |
|
||||
__fish_test_thrash_cd |
|
||||
__fish_test_thrash_cd
|
||||
|
||||
cd ""
|
||||
# CHECKERR: cd: Empty directory '' does not exist
|
||||
# CHECKERR: {{.*}}/cd.fish (line {{\d+}}):
|
||||
# CHECKERR: builtin cd $argv
|
||||
# CHECKERR: ^
|
||||
# CHECKERR: in function 'cd' with arguments '""'
|
||||
# CHECKERR: called on line {{\d+}} of file {{.*}}/cd.fish
|
||||
echo $status
|
||||
# CHECK: 1
|
||||
|
||||
Reference in New Issue
Block a user