diff --git a/Extension/src/Debugger/nativeAttach.ts b/Extension/src/Debugger/nativeAttach.ts index 669fe7570..462facd8d 100644 --- a/Extension/src/Debugger/nativeAttach.ts +++ b/Extension/src/Debugger/nativeAttach.ts @@ -117,7 +117,7 @@ export class PsProcessParser { // Note that comm on Linux systems is truncated to 16 characters: // https://bugzilla.redhat.com/show_bug.cgi?id=429565 // Since 'args' contains the full path to the executable, even if truncated, searching will work as desired. - public static get psLinuxCommand(): string { return `ps axww -o pid=,comm=${PsProcessParser.commColumnTitle},args=`; } + public static get psLinuxCommand(): string { return `ps axww -o pid= -o comm=${PsProcessParser.commColumnTitle} -o args=`; } public static get psDarwinCommand(): string { return `ps axww -o pid=,comm=${PsProcessParser.commColumnTitle},args= -c`; } public static get psToyboxCommand(): string { return `ps -A -o pid=,comm=${PsProcessParser.commColumnTitle},args=`; } diff --git a/Extension/test/scenarios/SingleRootProject/tests/extension.test.ts b/Extension/test/scenarios/SingleRootProject/tests/extension.test.ts index 62f06236a..ad51cf7b5 100644 --- a/Extension/test/scenarios/SingleRootProject/tests/extension.test.ts +++ b/Extension/test/scenarios/SingleRootProject/tests/extension.test.ts @@ -126,6 +126,12 @@ suite("Pick Process Tests", () => { assert.equal(process2.pid, '15220'); }); + test("Use portable ps options on Linux", () => { + assert.equal( + PsProcessParser.psLinuxCommand, + `ps axww -o pid= -o comm=${'a'.repeat(49)} -o args=`); + }); + test('Parse valid CIM output', () => { // output from the command used in CimAttachItemsProvider const cimOutput: string = String.raw`[