Nushell: Tab completion panics on Windows

Created on 2 Nov 2020  路  4Comments  路  Source: nushell/nushell

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

  1. Press the tab key.

Expected behavior

It shouldn't crash.

Configuration

OS: Windows 10 (2004)
Nu: 0.21.0

bug

All 4 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

twe4ked picture twe4ked  路  4Comments

ne-on picture ne-on  路  5Comments

KasMA1990 picture KasMA1990  路  4Comments

ryanpcmcquen picture ryanpcmcquen  路  3Comments

senden9 picture senden9  路  3Comments