From 50cfbd904cf923f215609a6e28438fea904d4d2a Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Thu, 14 Nov 2024 10:21:19 -0600 Subject: [PATCH] Show file extensions on available commands when not `.exe` (#9099) Closes https://github.com/astral-sh/uv/issues/8770 --- crates/uv/src/commands/project/run.rs | 6 +++++- crates/uv/tests/it/run.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/uv/src/commands/project/run.rs b/crates/uv/src/commands/project/run.rs index 3f59898c2..7002c59d7 100644 --- a/crates/uv/src/commands/project/run.rs +++ b/crates/uv/src/commands/project/run.rs @@ -897,7 +897,11 @@ pub(crate) async fn run( .map(|entry| entry.path()) .filter(|path| is_executable(path)) .map(|path| { - if cfg!(windows) { + if cfg!(windows) + && path + .extension() + .is_some_and(|exe| exe == std::env::consts::EXE_EXTENSION) + { // Remove the extensions. path.with_extension("") } else { diff --git a/crates/uv/tests/it/run.rs b/crates/uv/tests/it/run.rs index 8a2a04fff..cf3b69915 100644 --- a/crates/uv/tests/it/run.rs +++ b/crates/uv/tests/it/run.rs @@ -248,7 +248,7 @@ fn run_no_args() -> Result<()> { The following commands are available in the environment: - - pydoc + - pydoc.bat - python - pythonw