From ea51a21e0aaed0ffcab088bac8a28896cf34912a Mon Sep 17 00:00:00 2001 From: Jonathan Cardoso Date: Thu, 23 Feb 2023 21:37:11 +0000 Subject: [PATCH] fix debugger attach to process when running on WSL --- src/client/common/process/rawProcessApis.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/common/process/rawProcessApis.ts b/src/client/common/process/rawProcessApis.ts index fb5108322751..59b5fe69c9cd 100644 --- a/src/client/common/process/rawProcessApis.ts +++ b/src/client/common/process/rawProcessApis.ts @@ -13,6 +13,8 @@ import { noop } from '../utils/misc'; import { decodeBuffer } from './decoder'; import { traceVerbose } from '../../logging'; +const PS_ERROR_SCREEN_BOGUS = /your [0-9]+x[0-9]+ screen size is bogus\. expect trouble/; + function getDefaultOptions(options: T, defaultEnv?: EnvironmentVariables): T { const defaultOptions = { ...options }; const execOptions = defaultOptions as SpawnOptions; @@ -136,7 +138,13 @@ export function plainExec( } const stderr: string | undefined = stderrBuffers.length === 0 ? undefined : decodeBuffer(stderrBuffers, encoding); - if (stderr && stderr.length > 0 && options.throwOnStdErr) { + if ( + stderr && + stderr.length > 0 && + options.throwOnStdErr && + // ignore this specific error silently; see this issue for context: https://github.com/microsoft/vscode/issues/75932 + !(PS_ERROR_SCREEN_BOGUS.test(stderr) && stderr.replace(PS_ERROR_SCREEN_BOGUS, '').trim().length === 0) + ) { deferred.reject(new StdErrError(stderr)); } else { let stdout = decodeBuffer(stdoutBuffers, encoding);