-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: add PowerShell-specific command handling #1585
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
fix: add PowerShell-specific command handling #1585
Conversation
PowerShell requires special handling for command output due to two issues: - A sleep delay is required to prevent the ]633;D marker from losing the original output - A counter is needed to work around a bug where identical commands are not executed Changes: - Add cmdCounter to Terminal class for unique command tracking - Add PowerShell detection via platform and default shell profile - Add sleep delay to ensure output is captured before command completion Signed-off-by: Eric Wheeler <[email protected]>
|
Mock VSCode workspace configuration to handle PowerShell detection in terminal tests. This prevents TypeError when accessing getConfiguration() in TerminalProcess.run() Signed-off-by: Eric Wheeler <[email protected]>
|
Ah interesting; thanks for digging in! |
Add VSCode workspace configuration mock to TerminalProcess.test.ts to handle PowerShell detection in terminal tests, matching the fix in TerminalProcessExec.test.ts Signed-off-by: Eric Wheeler <[email protected]>
|
This link has this powershell work around rolled in if anybody wants to test in Windows; this is my site, so trust it if you trust me: Then run |
Description
This PR fixes two critical issues with PowerShell command execution in Windows environments:
The fix detects PowerShell environments by checking both the Windows platform and the VSCode terminal default profile configuration.
Test Procedure
Tested on Windows with PowerShell by:
Type of Change
Pre-flight Checklist
npm test) and code is formatted and linted (npm run format && npm run lint)npm run changeset(required for user-facing changes)Screenshots
I know this looks insane, but believe me, this is the only way to make it successful in the current state of upstream VSCE shell integration!
Additional Notes
The sleep delay (150ms) was chosen as the minimum value that reliably ensures output capture while maintaining responsiveness.
For some reason the command is always included in the output, but that is better than not having any output at all.
Important
Fixes PowerShell command execution issues in Windows by adding a command counter and sleep delay for output capture.
TerminalProcess.tsto ensure output capture.cmdCounterinTerminal.tsand using it inTerminalProcess.tsto make each command unique.cmdCountertoTerminalclass inTerminal.ts.run()inTerminalProcess.tsto appendcmdCounterand sleep delay to PowerShell commands.This description was created by
for a25f1d9. It will automatically update as commits are pushed.