Skip to content

Commit

Permalink
fix debugger attach to process when running on WSL (#267)
Browse files Browse the repository at this point in the history
Co-authored-by: JCMais <[email protected]>
Co-authored-by: Paula <[email protected]>
  • Loading branch information
3 people authored Apr 22, 2024
1 parent d7b67c0 commit 5cf35c9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/extension/common/process/rawProcessApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { ExecutionResult, ShellOptions, SpawnOptions, StdErrError } from './type
import { noop } from '../utils/misc';
import { decodeBuffer } from './decoder';

const PS_ERROR_SCREEN_BOGUS = /your [0-9]+x[0-9]+ screen size is bogus\. expect trouble/;

function getDefaultOptions<T extends ShellOptions | SpawnOptions>(options: T, defaultEnv?: EnvironmentVariables): T {
const defaultOptions = { ...options };
const execOptions = defaultOptions as SpawnOptions;
Expand Down Expand Up @@ -98,7 +100,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);
Expand Down

0 comments on commit 5cf35c9

Please sign in to comment.