Skip to content

Commit

Permalink
Added support for Toybox to remote process picker (#11175)
Browse files Browse the repository at this point in the history
* Added separate remote process command for ToyBox
  • Loading branch information
michalmaka authored Jul 26, 2023
1 parent d48fd43 commit a7870fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Extension/src/Debugger/attachToProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ export class RemoteAttachPicker {
shPrefix = `/bin/`;
}

return `${outerQuote}${shPrefix}sh -c ${innerQuote}uname && if [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Linux${escapedQuote} ] ; ` +
`then ${PsProcessParser.psLinuxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Darwin${escapedQuote} ] ; ` +
return `${outerQuote}${shPrefix}sh -c ${innerQuote}uname && if [ ${parameterBegin}uname -o${parameterEnd} = ${escapedQuote}Toybox${escapedQuote} ] ; ` +

This comment has been minimized.

Copy link
@rahiakil

rahiakil Aug 16, 2023

You completely messed it up. For Darwin it is now trying the Linux command and failing. How to raise a bug on this?

This comment has been minimized.

Copy link
@bobbrow

bobbrow Aug 16, 2023

Member

Thanks for raising this issue. PR to fix it here: #11329

`then ${PsProcessParser.psToyboxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Darwin${escapedQuote} ] ; ` +
`then ${PsProcessParser.psLinuxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Linux${escapedQuote} ] ; ` +
`then ${PsProcessParser.psDarwinCommand}; fi${innerQuote}${outerQuote}`;
}

Expand Down
1 change: 1 addition & 0 deletions Extension/src/Debugger/nativeAttach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export class PsProcessParser {
// 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 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=`; }

// Only public for tests.
public static ParseProcessFromPs(processes: string): Process[] {
Expand Down

0 comments on commit a7870fc

Please sign in to comment.