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

Don't abort instantly, keep searching #13243

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

fearthecowboy
Copy link
Member

It should not abort instantly when looking for powershell or pwsh

fixes #13137

@fearthecowboy fearthecowboy requested a review from a team as a code owner February 6, 2025 17:56
Copy link
Contributor

@sean-mcmanus sean-mcmanus left a comment

Choose a reason for hiding this comment

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

Shouldn't it call return undefined; at the very end of the function if it doesn't find anything?

@fearthecowboy
Copy link
Member Author

Shouldn't it call return undefined; at the very end of the function if it doesn't find anything?

It already does return undefined by virtue of not returning anything.

It would have done that before too when it didn't find anything. This just stops it from uselessly short-circuiting when it gets an exception from statSync.

Copy link
Contributor

@sean-mcmanus sean-mcmanus left a comment

Choose a reason for hiding this comment

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

Okay, I wasn't sure what the TypeScript behavior was or if would generate a warning.

@fearthecowboy fearthecowboy merged commit ebce162 into main Feb 6, 2025
6 checks passed
@fearthecowboy fearthecowboy deleted the dev/garretts/fix-findpowershell branch February 6, 2025 18:31
@bobbrow
Copy link
Member

bobbrow commented Feb 6, 2025

Shouldn't it call return undefined; at the very end of the function if it doesn't find anything?

It already does return undefined by virtue of not returning anything.

It would have done that before too when it didn't find anything. This just stops it from uselessly short-circuiting when it gets an exception from statSync.

While TypeScript does return undefined automatically in the absence of return undefined, I think it's preferable to be explicit.

@sean-mcmanus
Copy link
Contributor

@bobbrow Yeah, I'm not sure what the preferable TypeScript style is, but it would seem like if we wanted a style that prefers always returning something then it would be good to enforce that via an eslint rule (I haven't checked if one exists or not, but I thought it did a long time ago).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Attach to process tries to use Wmic on Windows 11 machine without it
3 participants