[PR #94] [MERGED] fix(win): find powershell.exe when it isn't on PATH #116

Closed
opened 2026-10-15 20:53:31 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rehan-remade/universal-modder/pull/94
Author: @AltDoug
Created: 10/5/2026
Status: ✅ Merged
Merged: 10/6/2026
Merged by: @rehan-remade

Base: main ← Head: fix/powershell-full-path


📝 Commits (1)

  • 5e7af7f fix(win): find powershell.exe when it isn't on PATH

📊 Changes

4 files changed (+32 additions, -7 deletions)

View changed files

📝 tests/test_um.py (+16 -0)
📝 um/common.py (+13 -0)
📝 um/scan.py (+2 -2)
📝 um/win.py (+1 -5)

📄 Description

um win ps, um win drive, um win record and the Windows folder lookup in um scan start PowerShell as bare powershell. On native Windows that only resolves if System32\WindowsPowerShell\v1.0 is on PATH. Agents often run with a trimmed PATH (e.g. Git Bash started by a terminal app), and then every um win command dies with:

FileNotFoundError: [WinError 2] The system cannot find the file specified

Repro (Git Bash, any PATH without that folder):

PATH=/usr/bin:<dir of python3> UM_NO_UV=1 bin/um win ps

Fix: ps_exe() moves to um/common.py. It still prefers what shutil.which finds, then falls back to %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe (/mnt/c/Windows/... under WSL). scan.win_folders() uses it too, so it no longer returns {} silently in the same case.

Tests: new test_ps_exe_falls_back_to_full_path (fails before, passes after); full suite 59 passed on Windows 11, Python 3.12. By hand: um win ps crashed under the trimmed PATH before the fix and lists windows after it.

Found and fixed with AI assistance (Claude Code); the repro and the fix were run by hand on Windows 11.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rehan-remade/universal-modder/pull/94 **Author:** [@AltDoug](https://github.com/AltDoug) **Created:** 10/5/2026 **Status:** ✅ Merged **Merged:** 10/6/2026 **Merged by:** [@rehan-remade](https://github.com/rehan-remade) **Base:** `main` ← **Head:** `fix/powershell-full-path` --- ### 📝 Commits (1) - [`5e7af7f`](https://github.com/rehan-remade/universal-modder/commit/5e7af7f4b35767096e322927285a093a50984edd) fix(win): find powershell.exe when it isn't on PATH ### 📊 Changes **4 files changed** (+32 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_um.py` (+16 -0) 📝 `um/common.py` (+13 -0) 📝 `um/scan.py` (+2 -2) 📝 `um/win.py` (+1 -5) </details> ### 📄 Description `um win ps`, `um win drive`, `um win record` and the Windows folder lookup in `um scan` start PowerShell as bare `powershell`. On native Windows that only resolves if `System32\WindowsPowerShell\v1.0` is on PATH. Agents often run with a trimmed PATH (e.g. Git Bash started by a terminal app), and then every `um win` command dies with: ``` FileNotFoundError: [WinError 2] The system cannot find the file specified ``` Repro (Git Bash, any PATH without that folder): ``` PATH=/usr/bin:<dir of python3> UM_NO_UV=1 bin/um win ps ``` Fix: `ps_exe()` moves to `um/common.py`. It still prefers what `shutil.which` finds, then falls back to `%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe` (`/mnt/c/Windows/...` under WSL). `scan.win_folders()` uses it too, so it no longer returns `{}` silently in the same case. Tests: new `test_ps_exe_falls_back_to_full_path` (fails before, passes after); full suite 59 passed on Windows 11, Python 3.12. By hand: `um win ps` crashed under the trimmed PATH before the fix and lists windows after it. Found and fixed with AI assistance (Claude Code); the repro and the fix were run by hand on Windows 11. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 20:53:31 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rehan-remade/universal-modder#116
No description provided.