Skip to content

Conversation

@WardenGnaw
Copy link
Contributor

Fixing error message for process picker.

Find and replace System32 for WSL bash because it spawns a 32 bit instance which bash.exe does not reside in System32 but rather sysnative.

child_process.exec will spawn a 32 bit process which
C:\Windows\System32\bash.exe will not exist and fail for process picker.
Will attempt to try to run C:\Windows\sysnative\bash.exe for process
picker.

This is not an issue if users just use bash.exe for pipeProgram.
public static ValidateAndFixPipeProgram(program: string): Promise<string> {
return PlatformInformation.GetCurrent().then(platformInfo => {
// If its 64 bit windows and the program does not exist. Try to replace System32 with sysnative
if (platformInfo.isWindows && platformInfo.architecture === "x86_64" && !fs.existsSync(program) && program.toLowerCase().includes("system32")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we don't enter the if block if the following condition is not satisfied program.toLowerCase().startsWith(process.env.SystemRoot + "system32").

}

// Return original program and let it fall through
return program;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible the program does not exist in the sysnative path as well. Should we try and return the original program path if file wasn't found in sysnative path as well?

Validating sysnative program before replacing.
@WardenGnaw WardenGnaw merged commit 6f53904 into dotnet:master Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants