I am using powershell mcp.
I can’t get the output of subprocesses when I am doing it. It basically runs powershell with node-powershell package and return the output. I was able to resolve it , but only if I add the reconfigure in python, which is not realistic.
Can someone explain what (the hell) happens here?
In this case only the second hello is printed.
[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8 $OutputEncoding = [System.Text.Encoding]::UTF8 chcp 65001 | Out-Null $env:PYTHONUTF8=1 $env:PYTHONUTF8=1 $env:PYTHONIOENCODING="utf-8" Write-Host $(python -c "print('hello')") Write-Host $(python -c "import sys; c=sys.getfilesystemencoding(); import sys; sys.stdout.reconfigure(encoding='utf-8');print('hello2');print(c);import os;print(os.getenv('PYTHONIOENCODING'))")
Here is the full output
``` ● powershell-mcp - execute-powershell (MCP)(command: "[System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8\n$OutputEncoding = [System.Text.Encoding]::UTF8\nchcp 65001 | Out-Null\n$env:PYTHONUTF8=1\n\nWrite-Host $(python -c \"print('hello')\")\nWrite-Host $(python -c \"import sys; sys.stdout.reconfigure(encoding='utf-8');print('hello2')\")") ⎿ ✅ Command executed successfully Stdout: hello2 Stderr: (none) Working Directory: Default ```