Skip to content

Commit

Permalink
Merge pull request #3961 from JoeRobich/fix-ps
Browse files Browse the repository at this point in the history
Ignore screen size is bogus errors with ps
  • Loading branch information
JoeRobich authored Aug 11, 2020
2 parents 45b80c6 + a1d265c commit 9e059df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
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

0 comments on commit 9e059df

Please sign in to comment.