fish.rs: fix regression in fish_xdm_login_hack_hack_hack_hack

This is off by one from the C++ version.

It wasn't super obvious why this worked in the first place.
Looks like args[0] is "-" because we are invoked like

    fish -c 'exec "${@}"' - "${@}"

and it looks like "-" is treated like "--" by bash, so we emulate that.
See https://github.com/fish-shell/fish-shell/issues/367#issuecomment-11740812
This commit is contained in:
Johannes Altmanninger 2023-10-13 19:04:07 +02:00
parent b8c5627eb1
commit 773a507b01

View file

@ -856,7 +856,7 @@ fn fish_xdm_login_hack_hack_hack_hack(cmds: &mut Vec<OsString>, args: &[&wstr])
// We're going to construct a new command that starts with exec, and then has the
// remaining arguments escaped.
let mut new_cmd = OsString::from("exec");
for arg in args {
for arg in &args[1..] {
new_cmd.push(" ");
new_cmd.push(escape_single_quoted_hack_hack_hack_hack(arg));
}