Do not add PATHEXT environment variable on Unix#7697
Do not add PATHEXT environment variable on Unix#7697iSazonov merged 9 commits intoPowerShell:masterfrom
Conversation
0717068 to
00d3bd0
Compare
03a7624 to
624dd23
Compare
|
@PowerShell/powershell-committee reviewed this and it seems that $env:PATHEXT can provide utility on Unix systems if the user creates the environment variable. Example is if user has |
SteveL-MSFT
left a comment
There was a problem hiding this comment.
Based on @PowerShell/powershell-committee conclusion, we should not make this change as there is utility for an end user to create the PATHEXT env var and use it on non-Windows
|
@SteveL-MSFT Your request was addressed. |
|
CI Appveyor temporary failed. |
| // Now check the extension and see if it's one of the ones in pathext | ||
| #if UNIX | ||
|
|
||
| if (Platform.NonWindowsIsExecutable(this.Path)) |
There was a problem hiding this comment.
Why not just:
return Platform.NonWindowsIsExecutable(this.Path);
There was a problem hiding this comment.
From PowerShell Committee conclusion we should fallback on Unix to read PATHEXT.
There was a problem hiding this comment.
Additional code would need to be added to support something like executing foo where foo.py exists and .py was added to PATHEXT on Unix since Windows takes care of this automatically. That is a feature and not bug fix so certainly out of scope of this PR. I'd also wait until there's customer request for such a feature.
There was a problem hiding this comment.
@SteveL-MSFT I fixed your request. Tracking issue #7755 .
|
Reopen the PR to restart CIs. |
|
@SteveL-MSFT: I don't think |
|
@SteveL-MSFT Please update your review. I believe we can merge. |
PR Summary
Address #3572.
On Windows we use file extensions to detect executables. Windows define a list of the extensions in PATHEXT environment variable by default. If the variable is absent Powershell added
env:PATHEXTspecial variable on all platforms. A problem is that on Unix the PATHEXT is not defined by default and is not needed. The fix exclude creating PATHEXT on Unix.It is a breaking change in grace area - no PowerShell scripts should depend on PATHEXT on Unix.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests