Describe the bug
When using tab completion, nushell panics with the following error:
``plain
thread 'main' panicked at 'byte index 1 is out of bounds of', C:\Users\Chris\AppData\Local\Programs\Rust\cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.21.0\src\completion\command.rs:69:24
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
[process exited with code 101]
````
The crash points to this line.
To Reproduce
Expected behavior
It shouldn't crash.
Configuration
OS: Windows 10 (2004)
Nu: 0.21.0
Ok so I note PATHEXT environment variable mentioned in the code. I looked at the variable on my system. It's defined like this:
".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;"
Note the trailing ;. This seems to be what's causing the crash because splitting at ; includes an empty string on the end. I'm not entirely sure what PATHEXT is for so I don't know if this is a common issue or one that's peculiar to my system. Either way I can workaround it for me by editing the environment variable (needs admin).
Feel free to close this issue if it's deemed to just be my weird system.
Sounds like a bug to me. I'm compiling a fix for it right now. :)
@ChrisDenton Can you try this from the latest main. If it's not fixed please re-open this issue.
Sure! I just tested version 0.21.0 alongside the version from latest main. 0.21.0 crashed and latest main worked as expected. I'd call that a fix. Thanks!