Skip to content

fix(shell): add | Out-String to PowerShell config_line#888

Merged
max-sixty merged 5 commits intomainfrom
885
Jan 28, 2026
Merged

fix(shell): add | Out-String to PowerShell config_line#888
max-sixty merged 5 commits intomainfrom
885

Conversation

@max-sixty
Copy link
Owner

Summary

  • Fix PowerShell shell integration failing with "Cannot convert 'System.Object[]'" error
  • PowerShell command output is an array by default, but Invoke-Expression expects a single string
  • Adding | Out-String converts the array to a single string

Fixes #885

Test plan

  • Added regression test test_powershell_config_line_evaluates_correctly (behind shell-integration-tests feature)
  • Test runs pwsh and verifies the function is defined correctly
  • pwsh is pre-installed on GitHub Actions runners

🤖 Generated with Claude Code

max-sixty and others added 4 commits January 27, 2026 15:25
PowerShell command output is an array of strings by default, but
`Invoke-Expression` expects a single string. Without `| Out-String`,
users get "Cannot convert 'System.Object[]' to the type 'System.String'".

Also adds PSModulePath hint to `wt config show` diagnostics on Windows.

Co-Authored-By: Claude <noreply@anthropic.com>
- Add bin_dir to PATH so `Get-Command wt` works in CI
- Remove PSModulePath diagnostic to fix Windows snapshot failures

Co-Authored-By: Claude <noreply@anthropic.com>
CARGO_BIN_EXE_wt is only available in integration tests, not lib tests.
Move the test to tests/integration_tests/shell_powershell.rs.

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty force-pushed the 885 branch 2 times, most recently from 875a2e8 to 70a8553 Compare January 28, 2026 02:25
PowerShell configs without `| Out-String` are now treated as "not installed"
so that `wt config shell install` will update them with the fix.

Key changes:
- PowerShell detection now uses case-insensitive matching
- Check for Invoke-Expression/iex BEFORE POSIX patterns to avoid false match
  on `if ` which appears in old PowerShell configs
- Add test for exact old canonical PowerShell line

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit 722e703 into main Jan 28, 2026
20 of 21 checks passed
@max-sixty max-sixty deleted the 885 branch January 28, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerShell shell integration is not working

1 participant