Windows: only shell out to cmd for specific commands#6253
Windows: only shell out to cmd for specific commands#6253rgwood merged 1 commit intonushell:mainfrom
Conversation
|
The only other built in that I use for troubleshooting sometimes in windows is And I like how this PR enables more nushell's fancy errors. Nice work! |
|
So can this issue: #4932 be closed? |
|
@hustcer Yes I think so |
|
Circling back: it seems I haven't tested, but this does merit investigation; if the builtins don't even function properly anymore, then exposing them through nushell doesn't make any sense. |
|
@CAD97 Good catch, agreed. Are you able to confirm that and submit a PR? |
|
I can confirm that |
Description
Nu has behaviour on Windows where, when it can't find an executable on disk, it will "shell out" to cmd.exe. This is because some common shell commands are implemented internally in cmd.exe and do not exist on disk. This PR changes the behaviour so we only shell out for a specific set of known internal commands: ASSOC, DIR, ECHO, FTYPE, MKLINK, START, VER, VOL
Deets
This change is motivated by 2 considerations:
I read through the full list of internal commands, and determined that those are the only ones likely to be useful in Nu. Here's a spreadsheet with reasoning for each command.
Prior to this PR:

After this PR:

Tests
Make sure you've done the following:
(no tests added - I think our existing tests cover this)
Make sure you've run and fixed any issues with these commands:
cargo fmt --all -- --checkto check standard code formatting (cargo fmt --allapplies these changes)cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collectto check that you're using the standard code stylecargo test --workspace --features=extrato check that all the tests pass