Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic checking for untitled or raw scripts #1839

Merged
merged 1 commit into from
Jun 22, 2022

Conversation

andyleejordan
Copy link
Member

This was much more easily accomplished by checking if what we were given
exists as a file path, in which case we use it as-is (a file path, that
must exist, since we launch it directly). Otherwise we can assume that
it's a raw script block, or a URI from the client that probably
represents an untitled file.

This was much more easily accomplished by checking if what we were given
exists as a file path, in which case we use it as-is (a file path, that
must exist, since we launch it directly). Otherwise we can assume that
it's a raw script block, or a URI from the client that probably
represents an untitled file.
@andyleejordan andyleejordan requested a review from a team June 22, 2022 19:14
@andyleejordan andyleejordan enabled auto-merge (squash) June 22, 2022 19:14
@andyleejordan
Copy link
Member Author

Fixes a bug introduced in #1830

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM!

// Script could an actual script, or a URI to a script file (or untitled document).
if (!System.Uri.IsWellFormedUriString(scriptToLaunch, System.UriKind.RelativeOrAbsolute)
|| ScriptFile.IsUntitledPath(scriptToLaunch))
if (System.IO.File.Exists(scriptToLaunch))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is going to break for remote files (e.g. you do an interactive Enter-PSSession and then psedit ./something.ps1) but that's also probably super broken atm anyway. Something we should revisit in the future, but definitely not a blocker to getting this fixed

@andyleejordan andyleejordan merged commit cd2cfdd into master Jun 22, 2022
@andyleejordan andyleejordan deleted the andschwa/untitled-check branch June 22, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants