Skip to content

Use pwsh instead of powershell for worktree creation#67

Merged
0101 merged 1 commit intomainfrom
fix-fork
Apr 24, 2026
Merged

Use pwsh instead of powershell for worktree creation#67
0101 merged 1 commit intomainfrom
fix-fork

Conversation

@0101
Copy link
Copy Markdown
Owner

@0101 0101 commented Apr 24, 2026

Problem

Creating worktrees via the dashboard or tm new triggers UAC elevation prompts on Windows. The server invokes fork.ps1 using powershell (Windows PowerShell 5.1), which cannot create symlinks without admin privileges — even when Developer Mode is enabled.

The elevation fallback inside fork.ps1 itself also calls Start-Process powershell -Verb RunAs, doubling down on the wrong shell.

Meanwhile the rest of the codebase (tm.cmd, treemon.ps1, SessionManager.fs) already uses pwsh consistently.

Fix

Replace powershell with pwsh (PowerShell 7+) in the two affected locations:

  • GitWorktree.fs — server-side process launch now uses pwsh -NoProfile -File instead of powershell -File
  • fork.ps1 — both symlink elevation fallbacks now use Start-Process pwsh with -NoProfile instead of Start-Process powershell

PowerShell 7+ can create symlinks without elevation when Developer Mode is enabled, so the elevation fallback path should no longer be reached on typical dev machines.

Tests

Build passes with zero warnings/errors:

dotnet build treemon.slnx --verbosity minimal
Build succeeded. 0 Warning(s) 0 Error(s)

Replace Windows PowerShell (powershell) with PowerShell 7+ (pwsh) in worktree
creation flow to eliminate UAC elevation prompts when creating symlinks.

- GitWorktree.fs: invoke fork.ps1 via pwsh with -NoProfile
- fork.ps1: elevation fallback uses pwsh with -NoProfile

PowerShell 7+ can create symlinks without admin privileges when Developer Mode
is enabled, unlike Windows PowerShell 5.1. The rest of the codebase already
uses pwsh consistently.
@0101 0101 merged commit 3f8c125 into main Apr 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant