-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: Add shell detection for Windows NanoServer containers #3634
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
base: master
Are you sure you want to change the base?
fix: Add shell detection for Windows NanoServer containers #3634
Conversation
Windows NanoServer containers don't have PowerShell installed, only cmd.exe. This change adds automatic detection to use PowerShell when available (ServerCore) and fallback to cmd when not (NanoServer). The solution uses: cmd /c where powershell >nul 2>&1 && powershell || cmd - Checks if powershell.exe exists in PATH - Uses PowerShell if available (better shell experience) - Falls back to cmd if PowerShell is not found Fixes derailed#1929
|
@derailed Would you be able to review this PR when you get a chance? This fix addresses issue #1929 by implementing automatic shell detection for Windows containers to support both ServerCore (PowerShell) and NanoServer (cmd.exe) images, rather than hardcoding PowerShell which fails on NanoServer. The solution uses a simple shell detection command that checks for PowerShell availability and falls back to cmd.exe if needed. I've tested it with both Windows container types and it's working as expected. Thanks for maintaining k9s! 🐶 |
|
This PR is stale because it has been open for 30 days with no activity. |
|
This PR is not stale - it addresses a real issue (#1929) with Windows NanoServer containers and includes a working solution that's been tested. Just needs a reviewer to take a look. 🙏 |
|
This PR is stale because it has been open for 30 days with no activity. |
|
Great fix. |
|
I also have the same issue, could you please merge this fix. |
Description
Adds automatic shell detection for Windows containers to support both ServerCore and NanoServer.
Problem
k9s currently hardcodes
powershellfor all Windows containers, which fails on NanoServer images that only includecmd.exe.Error logs:
Solution
Instead of hardcoding PowerShell, the fix uses shell detection:
This command:
where powershell>nul 2>&1)&&||Benefits
Testing
References
Fixes #1929