If relative path was used, use it

This was inadvertently changed in
ed78fd2a5f

Fixes #9143
This commit is contained in:
Fabian Boehm 2022-08-15 20:01:17 +02:00
parent c294c80214
commit 40733ca25b
2 changed files with 8 additions and 3 deletions

View file

@ -55,9 +55,8 @@ static get_path_result_t path_get_path_core(const wcstring &cmd, const wcstring_
// If the command has a slash, it must be an absolute or relative path and thus we don't bother
// looking for a matching command.
if (cmd.find(L'/') != wcstring::npos) {
wcstring abs_cmd = path_apply_working_directory(cmd, vars.get_pwd_slash());
int merr = test_path(abs_cmd);
return get_path_result_t{merr, std::move(abs_cmd)};
int merr = test_path(cmd);
return get_path_result_t{merr, cmd};
}
get_path_result_t best = noent_res;

View file

@ -568,3 +568,9 @@ $fish -c 'echo \utest'
# CHECKERR: fish: Invalid token '\utest'
# CHECKERR: echo \utest
# CHECKERR: ^~~~~^
printf '%s\n' "#!/bin/sh" 'echo $0' > $tmpdir/argv0.sh
chmod +x $tmpdir/argv0.sh
cd $tmpdir
./argv0.sh
# CHECK: ./argv0.sh