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

Replace WMIC call with a supported solution #123296

Closed
danielgary opened this issue May 7, 2021 · 2 comments · Fixed by #123895
Closed

Replace WMIC call with a supported solution #123296

danielgary opened this issue May 7, 2021 · 2 comments · Fixed by #123895
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues insiders-released Patch has been released in VS Code Insiders
Milestone

Comments

@danielgary
Copy link
Contributor

WMIC is deprecated and has been for some time. Currently it is used for determining if any integrated terminal instances have any child processes.

return spawnAsPromised('wmic', ['process', 'get', 'ParentProcessId']).then(stdout => {

There are PowerShell commands that can return the count of child processes given a parent process ID, but I'm not sure what the performance hit for using PowerShell would be.

@isidorn isidorn assigned Tyriar and meganrogge and unassigned isidorn May 7, 2021
@Tyriar Tyriar assigned weinand and unassigned Tyriar and meganrogge May 7, 2021
@riverar
Copy link

riverar commented May 13, 2021

Windows doesn't maintain strong parent/child process relationships, so the design here needs some more thinking.

If you're feeling gangster, you can call NtQueryInformationProcess with PROCESS_BASIC_INFORMATION and dig out the undocumented InheritedFromUniqueProcessId member.

But I wouldn't bother, because you then need to consider the process ID you retrieved could have already been recycled and now points to something else entirely.

@danielgary
Copy link
Contributor Author

Thanks for all the help @riverar !

@Tyriar Tyriar added this to the May 2021 milestone May 14, 2021
@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label May 18, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues insiders-released Patch has been released in VS Code Insiders
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@riverar @weinand @isidorn @Tyriar @danielgary @meganrogge and others