Skip to content

Fix run active file in terminal on paths with spaces under Windows#65331

Merged
Tyriar merged 5 commits intomicrosoft:masterfrom
nunottlopes:issue
Dec 27, 2018
Merged

Fix run active file in terminal on paths with spaces under Windows#65331
Tyriar merged 5 commits intomicrosoft:masterfrom
nunottlopes:issue

Conversation

@nunottlopes
Copy link
Contributor

@nunottlopes nunottlopes commented Dec 18, 2018

Fixes #62350.

When we run a file on powershell with a path that has a space in it instead of running "c:\Users\matb\folder\sp ace.html" it will now execute & 'c:\Users\matb\folder\sp ace.html'. This way powershell will be able to execute the file as it is pretended.
capture4

@Tyriar Tyriar changed the title Fix #62350 Fix run active file in terminal on paths with spaces under Windows Dec 27, 2018
@Tyriar Tyriar added this to the December/January 2019 milestone Dec 27, 2018
Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

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

Thanks!

@Tyriar Tyriar merged commit 87ff76a into microsoft:master Dec 27, 2018
c(this._escapeNonWindowsPath(stdout.trim()));
});
return;
} else if (hasSpace && (exe.indexOf('powershell') !== -1)) {
Copy link
Member

Choose a reason for hiding this comment

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

In the latest version of PowerShell, PowerShell Core (xplat, ships outside of Windows), the executable has been renamed to pwsh to prevent any conflicts with the PowerShell version that ships in Windows, called Windows PowerShell aka powershell.exe.

This fix should also include a check for the latest version of PowerShell as well.

exe.indexOf('powershell') !== -1 || exe.indexOf('pwsh') !== -1

Also, I think this fix only works on Windows, but PowerShell Core works on macOS and Linux.

cc @Tyriar I probably should have called out the executable name in the issue you tagged me in. My bad.

Copy link
Member

Choose a reason for hiding this comment

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

@TylerLeonhardt 👍, you can do a PR for that to get credit for it if you want?

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run active file does nothing on windows if file path has space in it

3 participants