Repository navigation
Description
Bug description
A Windows receipt-print support report from FloCafe 3.7.6 contains an enormous error beginning with:
Command failed: powershell -NoProfile -NonInteractive -EncodedCommand ...
The remainder is the full base64-encoded PowerShell/C# raw-print helper. This was presented as the printer failure and copied into the support ticket instead of a bounded, useful diagnosis.
The current code still has the same failure path.
Code validation
In printViaUSBWindows() (main/printers/thermal.ts):
const rawStderr = String(err.stderr || '').trim();
const cleanStderr = sanitizePowerShellStderr(rawStderr);
const detail = cleanStderr || String(err.message || '').trim();When PowerShell exits without stderr (for example, a process-level launch failure, kill, or timeout), Node's execFile error message includes the complete command line. Because the script is passed through -EncodedCommand, detail becomes a very large base64 blob. The backend returns it as the printer detail; the frontend then surfaces/copies it into the support flow.
Existing windows-print-stderr.test.ts coverage validates CLIXML cleanup only. It does not cover empty stderr plus a command-bearing err.message.
Steps to reproduce
- On Windows, make the
powershellraw-print subprocess fail at the process level without producing stderr (a forced timeout/kill or launch failure can be used in a test). - Attempt a receipt or KOT print.
- Inspect the returned
detail, toast/support payload, or generated support ticket.
Expected behavior
The user and support ticket receive a short, classified diagnostic such as "Windows print command timed out" or "Could not start the Windows print helper." Raw command lines, encoded scripts, temporary paths, and environment-derived arguments are never returned.
Actual behavior
The complete powershell ... -EncodedCommand <base64> invocation is returned as the printer error. It can overwhelm the UI/ticket, obscures the cause, and creates an avoidable data-exposure risk if command arguments change in the future.
Environment
- Windows x64
- Observed on FloCafe 3.7.6
- Receipt printing through the Windows raw spooler path
- Current main branch remains affected
Acceptance criteria
- Process-level PowerShell failures are mapped to bounded, user-facing messages without including the raw command or encoded helper.
- Timeout, abort, executable-not-found, and unknown process failures receive stable classifications.
- Detail length is capped before it reaches API responses, telemetry, or support-ticket payloads.
- Regression tests cover empty stderr with a command-bearing
err.messageand proveEncodedCommand/base64 is absent. - Existing clean stderr and CLIXML diagnostics remain intact.
Activity
khaira777 commentedon Sep 21, 2026
working on a fix