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

Ignore screen size is bogus errors with ps #3961

Merged
merged 2 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
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
22 changes: 5 additions & 17 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function execChildProcess(command: string, workingDirectory: string
if (error) {
reject(error);
}
else if (stderr && stderr.length > 0) {
else if (stderr && !stderr.includes("screen size is bogus")) {
reject(new Error(stderr));
}
else {
Expand All @@ -60,13 +60,13 @@ export async function execChildProcess(command: string, workingDirectory: string

export async function getUnixChildProcessIds(pid: number): Promise<number[]> {
return new Promise<number[]>((resolve, reject) => {
let ps = cp.exec('ps -A -o ppid,pid', (error, stdout, stderr) => {
cp.exec('ps -A -o ppid,pid', (error, stdout, stderr) => {
if (error) {
return reject(error);
}

if (stderr) {
return reject(stderr);
if (stderr && !stderr.includes("screen size is bogus")) {
return reject(new Error(stderr));
}

if (!stdout) {
Expand All @@ -87,18 +87,6 @@ export async function getUnixChildProcessIds(pid: number): Promise<number[]> {

resolve(children);
});

ps.on('error', reject);

ps.stderr.setEncoding('utf8');
ps.stderr.on('data', data => {
const e = data.toString();
if (e.indexOf('screen size is bogus') >= 0) {
// ignore this error silently; see https://github.com/microsoft/vscode/issues/75932
} else {
reject(new Error(data.toString()));
}
});
});
}

Expand Down Expand Up @@ -193,4 +181,4 @@ export function isSubfolderOf(subfolder: string, folder: string): boolean {

// Check to see that every sub directory in subfolder exists in folder.
return subfolderArray.length <= folderArray.length && subfolderArray.every((subpath, index) => folderArray[index] === subpath);
}
}
4 changes: 2 additions & 2 deletions src/features/processPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class RemoteAttachPicker {
let name: string = args ? args.name : null;

if (!name) {
// Config name not found.
// Config name not found.
return Promise.reject<string>(new Error("Name not defined in current configuration."));
}

Expand Down Expand Up @@ -497,7 +497,7 @@ async function execChildProcess(process: string, workingDirectory: string): Prom
return;
}

if (stderr && stderr.length > 0) {
if (stderr && !stderr.includes("screen size is bogus")) {
reject(new Error(stderr));
return;
}
Expand Down