-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Only allow -File
to accept .ps1
scripts on Windows
#15859
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
src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs
Outdated
Show resolved
Hide resolved
…eterParser.cs Co-authored-by: Ilya <darpa@yandex.ru>
static analysis failures are not related to this PR, still not sure why those URLs fail in CI but work locally from my dev machine unless CI is using a proxy for internet. |
src/Microsoft.PowerShell.ConsoleHost/host/msh/CommandLineParameterParser.cs
Outdated
Show resolved
Hide resolved
…eterParser.cs Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
Don't know why codeql is failing as it's complaining about |
-File
to accept .ps1 scripts on Windows-File
to accept .ps1
scripts on Windows
🎉 Handy links: |
🎉 Handy links: |
PR Summary
A change was made previously to support shebang on Linux to accept files without requiring .ps1 extension. However, Windows doesn't support shebang, so we should be consistent with Windows PowerShell and only allow for scripts with .ps1 extension.
Fix is to update consolehost
-File
parsing path to check if the file has a.ps1
extension on Windows and return an error.A bunch of tests had to be updated with the new behavior.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).