Skip to content

Commit e3ec5cd

Browse files
authored
fix(computer): suppress PowerShell CLIXML progress noise on Windows (#2756)
Add $ProgressPreference = 'SilentlyContinue' to the runPowershell helper so non-interactive PowerShell child processes no longer emit CLIXML progress records (starting with '#< CLIXML') into stdout. This noise appeared in @midscene/computer health check logs (screenshot, monitor listing) and wasted tokens in agent flows. Fixes #2751
1 parent b4c3a31 commit e3ec5cd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/computer/src/device.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,11 @@ function escapePowershellSingleQuoted(value: string): string {
252252
* no-op here while making the invocation look more privileged to auditing.
253253
*/
254254
function runPowershell(script: string): string {
255-
const encoded = Buffer.from(script, 'utf16le').toString('base64');
255+
// Suppress PowerShell progress output (CLIXML) that non-interactive
256+
// child processes emit to stdout — it shows up as `#< CLIXML` XML noise
257+
// in Midscene logs and wastes tokens in agent flows (#2751).
258+
const prefixed = `$ProgressPreference = 'SilentlyContinue'\n${script}`;
259+
const encoded = Buffer.from(prefixed, 'utf16le').toString('base64');
256260
return execFileSync(
257261
'powershell.exe',
258262
['-NoProfile', '-NonInteractive', '-EncodedCommand', encoded],

0 commit comments

Comments
 (0)