arduino / arduino/Arduino

"pwsh not found in %PATH%" on Windows + MacOS

Open
#11,565 1 comment 1 reaction 0 assignees View on GitHub
Component: IDE Type: Bug
Dominant language
Java
Stars
14.6k
Forks
7k
PR merge metrics
No merged PRs in 30d

Description

# Issue
Powershell can be installed on Windows or MacOS and a script is used from a custom `platform.txt` but the `pwsh` fails to be found even though it can be ran from any `cmd` windows or terminal

# Reproducer
Winows Powershell 7 can be obtained from the store here https://www.microsoft.com/store/productId/9MZ1SNWT0N5D
Then in Platform.txt add:
`recipe.hooks.sketch.prebuild.01.pattern=pwsh`

# Diagnostics
On windows `pwsh` is installed to `C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.3.0_x64__8wekyb3d8bbwe` which is not part of 'path' however there is some sort of symlink (alias?) that is used
MacOs similar occurrence but a symlink exists to `/usr/local/microsoft/powershell/7` but Ardunio IDE doens't seem to follow links.

# Workaround
Pretty hacky and destined to fail after an update but on Windows adding the `C:\Program Files\WindowsApps\Microsoft.PowerShell_7.1.3.0_x64__8wekyb3d8bbwe` to PATH environment is a workaround, we tried to repeat it on MacOS but modifying PATH was not as easy.

# Conclusion
The Arduino IDE is not following/supporting Symlinks in some manner and/or launching in some 'custom' manner that does not reproduce what a `cmd` or `terminal` prompt can launch.

Contributor guide

Open the contributing guide

Research direction

Start with the custom platform.txt hook recipe.hooks.sketch.prebuild.01.pattern=pwsh and reproduce it on Windows and macOS. Compare how the IDE-launched hook resolves pwsh with the behavior from cmd or a terminal; done means the installed PowerShell command, including the reported symlink or alias, is found without the PATH workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.