File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff 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 => {
You can’t perform that action at this time.
0 commit comments