nushell/nushell

Support `/c` as alias for `-c` argument on Windows

Open

#7,993 建立於 2023年2月7日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)Rust (39,478 star) (2,129 fork)batch import
category:enhancementdeprecated:platform-specifichelp wanted

描述

Related problem

On Windows, if I set the ComSpec environment variable (which specifies the command interpreter) to C:\Users\Victor\.cargo\bin\nu.exe, and then call libc::system (Microsoft docs) with whatever given command, I get the following error message:

Error: nu::shell::file_not_found (link)

  × File not found
   ╭─[source:1:1]
 1 │ nu
   · ▲
   · ╰── Could not access file '/c': "The system cannot find the file specified. (os error 2)"
   ╰────

I suspect this happens because the libc::system call expects the command interpreter to respond to the /c flag by running the given command. Unfortunately, nushell interprets the /c as a script file argument and attempts to open it, resulting in the above error message.

Describe the solution you'd like

Support /c as an alias for the -c argument on Windows (or all platforms, if that's easier).

Describe alternatives you've considered

No response

Additional context and details

No response

貢獻者指南

Support `/c` as alias for `-c` argument on Windows · nushell/nushell#7993 | Good First Issue