Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debugger attach to process when running on WSL #20741

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/client/common/process/rawProcessApis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<T extends ShellOptions | SpawnOptions>(options: T, defaultEnv?: EnvironmentVariables): T {
const defaultOptions = { ...options };
const execOptions = defaultOptions as SpawnOptions;
Expand Down Expand Up @@ -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);
Expand Down