Skip to content

fix: expanded process title checks for windows shell identification @W-21239801@#1548

Merged
jfeingold35 merged 1 commit intomainfrom
d/W-21239801-b
Mar 2, 2026
Merged

fix: expanded process title checks for windows shell identification @W-21239801@#1548
jfeingold35 merged 1 commit intomainfrom
d/W-21239801-b

Conversation

@jfeingold35
Copy link
Copy Markdown
Contributor

This PR fixes issue #1538 . Sort of. See explanation:

The issue in question is how to reliably identify whether Windows is running in Powershell. Previously, we were checking the process title for strings like powershell and command prompt, which was causing problems in some situations where the process title used pwsh instead of powershell.

However, it turns out that there's not really any better alternative than this. I tried using process.ppid to check the parent process, but since the CLI is run through a batch script, powershell spins up a cmd process to execute that instead of doing it directly, so that didn't work. I looked into crawling up the chain of parent process ancestry, but that seemed like way too intensive a solution for this particular problem.

So what I've done here is just add pwsh and cmd to the strings that the shell identification checks for. If the process title has either of those, it'll match.

If someone else wants to implement a more intensive solution, they're welcome to do so.

@jfeingold35 jfeingold35 merged commit dc3fda4 into main Mar 2, 2026
88 checks passed
@jfeingold35 jfeingold35 deleted the d/W-21239801-b branch March 2, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants