nushell / nushell/nushell

redundant escape of `"` in command `run-external`

Open
#16,264 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A:external-commands A:quoting-expansion status:needs-triage
Dominant language
Rust
Stars
40.5k
Forks
2.3k
Avg merge
1d 14h
Merged PRs (30d)
79

Description

Describe the bug

when I run

C:/Windows/System32/cmd.exe /E:ON /C r#'"C:/Program Files (x86)/Intel/oneAPI/setvars.bat" intel64 vs2022 && set'#

it failed with

'\"C:/Program Files (x86)/Intel/oneAPI/setvars.bat\"' is not recognized as an internal or external command,
operable program or batch file.

Here you can see, nu escape the " with \, even when the raw string sigil(r#') is used.
And the stupid cmd can only read "C:/Program Files (x86)/Intel/oneAPI/setvars.bat".
So can we avoid this escape somehow??

How to reproduce

follow the describe

Expected behavior
  1. just follow the describe
Configuration
key value
version 0.106.0
major 0
minor 106
patch 0
branch
commit_hash 1b01625e1e9af2a1e3e51b3c26565644975c8228
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.86.0 (05f9846f8 2025-03-31)
rust_channel 1.86.0-x86_64-pc-windows-msvc
cargo_version cargo 1.86.0 (adf9b6ad1 2025-02-28)
build_time 2025-07-23 15:13:30 +00:00
build_rust_channel release
allocator standard
features default, plugin, rustls-tls, sqlite, trash-support
installed_plugins
experimental_options example=false, reorder-cell-paths=false

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows command shown in the issue and trace the run-external argument handling, especially how the raw-string command is passed to cmd.exe. Add a regression test covering the quoted batch-file path and verify that the command reaches cmd.exe without the redundant backslashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.