Skip to content
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
7 changes: 6 additions & 1 deletion Extension/src/Debugger/attachToProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class RemoteAttachPicker {
let parameterBegin: string = `$(`;
let parameterEnd: string = `)`;
let escapedQuote: string = `\\\"`;
let shPrefix: string = ``;

const settings: CppSettings = new CppSettings();
if (settings.useBacktickCommandSubstitution) {
Expand All @@ -126,8 +127,12 @@ export class RemoteAttachPicker {
innerQuote = `"`;
outerQuote = `'`;
}
// Also use a full path on Linux, so that we can use transports that need a full path such as 'machinectl' to connect to nspawn containers.
if (os.platform() === "linux") {
shPrefix = `/bin/`;
}

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