Windows: Exec tool returns empty output unless pty: true
Work around affected Windows sessions where non-PTY exec produces no output or side effects by forcing PTY and optionally capturing clean output via a temp file.
Symptoms
- On Windows (10/11),
exectool calls withpty: false(or omitted) return empty output. - Even commands that should have side effects appear to do nothing:
echo test > file.txtdoes not createfile.txtWrite-Output testprints nothing
- The same commands work when
pty: true.
Cause
This has affected the Windows non-PTY execution path in some OpenClaw versions or sessions. Using pty: true routes
execution through a different code path that can restore output while you confirm whether your installed version still
has the issue.
Fix
1) Force PTY for affected exec calls on Windows
When the non-PTY path is returning empty output, include pty: true:
{ "command": "echo test", "pty": true }
2) If you need clean output, round-trip through a temp file
PTY mode can include ANSI escape sequences in the returned output. A simple workaround is to redirect output to a temp file and then read it back:
powershell -NoProfile -Command "echo test | Out-File -FilePath $env:TEMP\\exec.out -Encoding utf8; Get-Content $env:TEMP\\exec.out"
Verify
Run an exec call with pty: true:
echo test
You should see test in the tool output. If you use redirection, confirm the file actually exists and has content.