-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Do not add PATHEXT environment variable on Unix #7697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
rjmholt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
SteveL-MSFT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just:
return Platform.NonWindowsIsExecutable(this.Path);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From PowerShell Committee conclusion we should fallback on Unix to read PATHEXT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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