Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cmd.exe detection heuristic (#2226)
## Summary Follow up from discussion in #2223 Detect CMD.exe by checking if `PROMPT` env var is set on windows, otherwise assume it's PowerShell. Note, this will not work if user modifies their system env vars to include `PROMPT` by default or if they launch nested PowerShell from Command Prompt (e.g. `Developer PowerShell for VS 2022`). ## Test Plan Only tested locally, although we try to add some CI tests that specifically use CMD.exe Command Prompt ``` Microsoft Windows [Version 10.0.19044.3086] (c) Microsoft Corporation. All rights reserved. Z:\Users\samypr100\dev\uv>Z:\Users\samypr100\.cargo\bin\cargo.exe +stable run --color=always -- venv "Foo Bar" Finished dev [unoptimized + debuginfo] target(s) in 0.69s Running `target\debug\uv.exe venv "Foo Bar"` Using Python 3.12.2 interpreter at: Z:\Users\samypr100\AppData\Local\Programs\Python\Python312\python.exe Creating virtualenv at: Foo Bar Activate with: "Foo Bar\Scripts\activate" ``` Power Shell ``` Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS Z:\Users\samypr100\dev\uv>Z:\Users\samypr100\.cargo\bin\cargo.exe +stable run --color=always -- venv "Foo Bar" Finished dev [unoptimized + debuginfo] target(s) in 0.63s Running `target\debug\uv.exe venv "Foo Bar"` Using Python 3.12.2 interpreter at: Z:\Users\samypr100\AppData\Local\Programs\Python\Python312\python.exe Creating virtualenv at: Foo Bar Activate with: & "Foo Bar\Scripts\activate" ```
- Loading branch information