@@ -191,7 +191,7 @@ export class RemoteAttachPicker {
191191 return args . map ( arg => this . quoteArg ( arg ) ) . join ( " " ) ;
192192 }
193193
194- public static async ShowAttachEntries ( args : any ) : Promise < string > {
194+ public static async ShowAttachEntries ( args : any , platformInfo : PlatformInformation ) : Promise < string > {
195195 // Create remote attach output channel for errors.
196196 if ( ! RemoteAttachPicker . _channel ) {
197197 RemoteAttachPicker . _channel = vscode . window . createOutputChannel ( 'remote-attach' ) ;
@@ -216,7 +216,7 @@ export class RemoteAttachPicker {
216216 let pipeTransport = this . getPipeTransportOptions ( args . pipeTransport , os . platform ( ) ) ;
217217
218218 return RemoteAttachPicker . createPipeCmd ( pipeTransport . pipeProgram , pipeTransport . pipeArgs , pipeTransport . quoteArgs )
219- . then ( async pipeCmd => RemoteAttachPicker . getRemoteOSAndProcesses ( pipeCmd ) )
219+ . then ( async pipeCmd => RemoteAttachPicker . getRemoteOSAndProcesses ( pipeCmd , platformInfo ) )
220220 . then ( processes => {
221221 let attachPickOptions : vscode . QuickPickOptions = {
222222 matchOnDescription : true ,
@@ -229,10 +229,10 @@ export class RemoteAttachPicker {
229229 }
230230 }
231231
232- public static async getRemoteOSAndProcesses ( pipeCmd : string ) : Promise < AttachItem [ ] > {
232+ public static async getRemoteOSAndProcesses ( pipeCmd : string , platformInfo : PlatformInformation ) : Promise < AttachItem [ ] > {
233233 const scriptPath = path . join ( getExtensionPath ( ) , 'scripts' , 'remoteProcessPickerScript' ) ;
234234
235- return execChildProcessAndOutputErrorToChannel ( `${ pipeCmd } < ${ scriptPath } ` , null , RemoteAttachPicker . _channel ) . then ( output => {
235+ return execChildProcessAndOutputErrorToChannel ( `${ pipeCmd } < ${ scriptPath } ` , null , RemoteAttachPicker . _channel , platformInfo ) . then ( output => {
236236 // OS will be on first line
237237 // Processess will follow if listed
238238 let lines = output . split ( / \r ? \n / ) ;
@@ -504,23 +504,21 @@ async function execChildProcess(process: string, workingDirectory: string): Prom
504504// VSCode cannot find the path "c:\windows\system32\bash.exe" as bash.exe is only available on 64bit OS.
505505// It can be invoked from "c:\windows\sysnative\bash.exe", so adding "c:\windows\sysnative" to path if we identify
506506// VSCode is running in windows and doesn't have it in the path.
507- async function GetSysNativePathIfNeeded ( ) : Promise < NodeJS . ProcessEnv > {
508- return PlatformInformation . GetCurrent ( ) . then ( platformInfo => {
509- let env = process . env ;
510- if ( platformInfo . isWindows ( ) && platformInfo . architecture === "x86_64" ) {
511- let sysnative : String = process . env . WINDIR + "\\sysnative" ;
512- env . Path = process . env . PATH + ";" + sysnative ;
513- }
507+ async function GetSysNativePathIfNeeded ( platformInfo : PlatformInformation ) : Promise < NodeJS . ProcessEnv > {
508+ let env = process . env ;
509+ if ( platformInfo . isWindows ( ) && platformInfo . architecture === "x86_64" ) {
510+ let sysnative : String = process . env . WINDIR + "\\sysnative" ;
511+ env . Path = process . env . PATH + ";" + sysnative ;
512+ }
514513
515- return env ;
516- } ) ;
514+ return env ;
517515}
518516
519- async function execChildProcessAndOutputErrorToChannel ( process : string , workingDirectory : string , channel : vscode . OutputChannel ) : Promise < string > {
517+ async function execChildProcessAndOutputErrorToChannel ( process : string , workingDirectory : string , channel : vscode . OutputChannel , platformInfo : PlatformInformation ) : Promise < string > {
520518 channel . appendLine ( `Executing: ${ process } ` ) ;
521519
522520 return new Promise < string > ( async ( resolve , reject ) => {
523- return GetSysNativePathIfNeeded ( ) . then ( newEnv => {
521+ return GetSysNativePathIfNeeded ( platformInfo ) . then ( newEnv => {
524522 child_process . exec ( process , { cwd : workingDirectory , env : newEnv , maxBuffer : 500 * 1024 } , ( error : Error , stdout : string , stderr : string ) => {
525523 let channelOutput = "" ;
526524
0 commit comments