Skip to content

Commit 2806ac7

Browse files
Merge pull request #1210 from OmniSharp/master
Merge remote process listing fix to release
2 parents 90c1216 + 1ba11cd commit 2806ac7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/features/processPicker.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,13 @@ export class RemoteAttachPicker {
117117
}
118118

119119
public static getRemoteOSAndProcesses(pipeCmd: string): Promise<AttachItem[]> {
120+
121+
// If the client OS is NOT Windows, we need to escape '$(uname)' as otherwise it will be evaluated on the client side
122+
// If the client OS is Windows, we don't want to do that as it will be sent as-is, and thus the if statement will be broken
123+
const remoteUnameCommand = os.platform() !== "win32" ? "$\\(uname\\)" : "$(uname)";
124+
120125
// Commands to get OS and processes
121-
const command = `bash -c 'uname && if [ $(uname) == "Linux" ] ; then ${RemoteAttachPicker.linuxPsCommand} ; elif [ $(uname) == "Darwin" ] ; ` +
126+
const command = `bash -c 'uname && if [ "${remoteUnameCommand}" == "Linux" ] ; then ${RemoteAttachPicker.linuxPsCommand} ; elif [ "${remoteUnameCommand}" == "Darwin" ] ; ` +
122127
`then ${RemoteAttachPicker.osxPsCommand}; fi'`;
123128

124129
return execChildProcessAndOutputErrorToChannel(`${pipeCmd} "${command}"`, null, RemoteAttachPicker._channel).then(output => {

0 commit comments

Comments
 (0)