Skip to content

Conversation

@fearthecowboy
Copy link
Contributor

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
Contributor 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

4 participants