test: fix windows parallels agent quoting

This commit is contained in:
Peter Steinberger 2026-03-23 16:39:05 -07:00
parent 34dc712f36
commit ea99984e23
No known key found for this signature in database
2 changed files with 11 additions and 20 deletions

View File

@ -46,6 +46,7 @@ Use this skill for Parallels guest workflows and smoke interpretation. Do not lo
- Always use `prlctl exec --current-user`; plain `prlctl exec` lands in `NT AUTHORITY\\SYSTEM`.
- Prefer explicit `npm.cmd` and `openclaw.cmd`.
- Use PowerShell only as the transport with `-ExecutionPolicy Bypass`, then call the `.cmd` shims from inside it.
- Multi-word `openclaw agent --message ...` checks should call `& $openclaw ...` inside PowerShell, not `Start-Process ... -ArgumentList` against `openclaw.cmd`, or Commander can see split argv and throw `too many arguments for 'agent'`.
- Windows installer/tgz phases now retry once after guest-ready recheck; keep new Windows smoke steps idempotent so a transport-flake retry is safe.
- Keep onboarding and status output ASCII-clean in logs; fancy punctuation becomes mojibake in current capture paths.
- If you hit an older run with `rc=255` plus an empty `fresh.install-main.log` or `upgrade.install-main.log`, treat it as a likely `prlctl exec` transport drop after guest start-up, not immediate proof of an npm/package failure.

View File

@ -333,32 +333,22 @@ guest_run_openclaw() {
local env_value="${2:-}"
shift 2
local args_literal stdout_name stderr_name env_name_q env_value_q
local args_literal env_name_q env_value_q
args_literal="$(ps_array_literal "$@")"
stdout_name="openclaw-stdout-$RANDOM-$RANDOM.log"
stderr_name="openclaw-stderr-$RANDOM-$RANDOM.log"
env_name_q="$(ps_single_quote "$env_name")"
env_value_q="$(ps_single_quote "$env_value")"
guest_powershell "$(cat <<EOF
\$stdout = Join-Path \$env:TEMP '$stdout_name'
\$stderr = Join-Path \$env:TEMP '$stderr_name'
try {
if ('${env_name_q}' -ne '') {
Set-Item -Path ('Env:' + '${env_name_q}') -Value '${env_value_q}'
}
\$proc = Start-Process -FilePath (Join-Path \$env:APPDATA 'npm\openclaw.cmd') -ArgumentList $args_literal -NoNewWindow -PassThru -RedirectStandardOutput \$stdout -RedirectStandardError \$stderr
\$proc.WaitForExit()
if (Test-Path \$stdout) {
Get-Content \$stdout
}
if (Test-Path \$stderr) {
Get-Content \$stderr
}
exit \$proc.ExitCode
} finally {
Remove-Item \$stdout, \$stderr -Force -ErrorAction SilentlyContinue
\$openclaw = Join-Path \$env:APPDATA 'npm\openclaw.cmd'
\$args = $args_literal
if ('${env_name_q}' -ne '') {
Set-Item -Path ('Env:' + '${env_name_q}') -Value '${env_value_q}'
}
\$output = & \$openclaw @args 2>&1
if (\$null -ne \$output) {
\$output | ForEach-Object { \$_ }
}
exit \$LASTEXITCODE
EOF
)"
}