-
Notifications
You must be signed in to change notification settings - Fork 76
Due to wmic has been deprecated. Replace wmic command in attach process with powershell command. #858
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
base: main
Are you sure you want to change the base?
Conversation
due to wmic has been deprecated create this file to replace wmicProcessParser.ts Successfully attach and debug python debugger todo: use pipe to instead powershell file perf data test cases
json format with camelCase Add Get-WmiObject For the legacy compatibility
If PowerShell is unavailable on Windows, the process provider now falls back to using WMIC for process listing. This improves compatibility with older Windows systems where PowerShell may not be present.
The unit tests need to specify list command because we have two commands on Windows now. The AttachProcessProvider now accepts an optional ProcessListCommand parameter in getAttachItems and _getInternalProcessEntries, allowing callers to specify the process listing command. Updated unit tests to use the new parameter for more precise control over process command selection.
Added a unit test to verify that Python processes are listed at the top when using the PowerShell process parser in getAttachItems. This ensures consistent process ordering across both WMIC and PowerShell implementations.
add single powershell unit test add windows powershell call when powershell has been installed add windows wmic call when powershell hasn't been installed
@microsoft-github-policy-service agree |
Remove console.log for processCmd to clean up output.
|
Is it really worth adding the fallback to the old WMI cmdlet? |
Thank you for raising this! You're absolutely right from a technical standpoint – Get-CimInstance has been around since PowerShell v3 and is indeed ubiquitous. I added the fallback logic through Get-WmiObject and even down to WMIC, mostly out of a "just-in-case" mindset, trying to maximize compatibility as a community dev for anyone who might run this in a locked-down or legacy environment. That said, I'm not attached to the extra fallbacks. Think of this PR as a conversation starter. I'm totally fine with any of these approaches:
If Microsoft prefers to simplify the code and drop the legacy support, I'm 100% on board. Just let me know what you'd like, and I'll update the PR accordingly. I'll happily strip it out. |
|
Hello @eleanorjboyd. I hope it's okay to follow up on this. I wanted to check if there is a reviewer available to look at this PR. Please let me know if there's anything I can do to assist in moving the process along. I appreciate your time and consideration. |
|
Sorry for the delay! @Tyriar could you take a look at this by chance? Karthik also mentioned you have a package that returns this process info you made- would this be a fit to switch over to using that and would that be advantageous? |
|
@eleanorjboyd this is that package: https://github.com/microsoft/vscode-windows-process-tree, yes I'd recommend using that over launching pwsh as it was built for speed and avoids launching any processes. |
Is this replacement already WIP? If not, I'd be happy to pick this up and work on integrating the vscode-windows-process-tree package to replace the current pwsh launching method. ETD is end of month. |
|
no it hasn't been started - we would greatly appreciate your help! |
Perfect. I'll get started on it right away. Thanks! ;D |
@Tyriar Thanks for the information. I'll proceed with the implementation.
On Linux/macOS, the code will remain unchanged and use the existing ps command. Looking forward to your feedback on the fallback strategy. Thanks for your guidance! |
I'm not sure about the performance of that particular command, but the main problem on Windows is launching processes has extra overhead which is noticeable when called a lot. |
Agreed. The native module is the optimal solution as it requires no process launch. |
Hi,
According to issue #744, WMIC is deprecated as of Windows 10 version 21H1 and the 21H1 semi-annual channel release of Windows Server. This utility is superseded by Windows PowerShell for WMI.
Changes:
Additional changes:
Best Regards
Charles