Fix (code) editor launch on Windows #33
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Windows, running:
fails with the following error:
when I do have Visual Studio Code installed.
I am using dotnet-config 1.0 RC1.
The problem is how the tool seems to be using
where
on Windows to locatecode
and using its output. Runningwhere code
in a shell on my box gives two paths:The tool uses the first line of the output only, which identifies a
sh
script, not a Windows binary.This PR fixes the issue by using
PATHEXT
environment variable on Windows to get the list of known executable extensions and sendingcode
plus those extensions towhere
. For example, on my machine,PATHEXT
has the value:So now,
where
is run by the tool as follows:The output I get is:
Fortunately, the not found cases go to standard error so the existing code that just picks up the first line of standard output doesn't need any change. I did however have to redirect standard error to avoid having the not found cases appear where
dotnet config -e
is run.Fixes #35