-
Notifications
You must be signed in to change notification settings - Fork 5k
Proposal: Add new property for getting process command line, environment and parent process #21941
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
Comments
We could use this in MSBuild. We attempt to find worker processes to connect to by enumerating running MSBuild processes and then trying to connect to them. On Windows + full framework, this is done with |
|
I think a |
Unless you're not on Windows. Then to get a single string you have to join the native process args, so you lose information. |
In that case, we should be able to do the same thing on windows as .net executables do to get the |
Oh, now I understand that we may be talking about the environment. And in that case |
Ah, sorry! Yes, |
it is a string in |
This would also fix PowerShell Get-Process missing the command line argument |
@joeloff asked today about getting parent process ID, for an installer scenario. I suppose the argument for returning a Process object vs GetProcessById() is to avoid races with pid recycling. I wonder whether it would help to consider environment, command line, and parent as separate requests. |
Rationale and Usage
When writing tools, it is often useful to be able to get to information about the processes you manage.
This is easy on Linux with /proc, but harder on windows.
When getting parent process, it is important to check the start time of the process with the PID of the queried process to see if it is older to prevent errors when process ids are recycled.
API proposal
I would suggest returning
null
if the user doesn't have access to the requested property instead of having to handle exceptions.The text was updated successfully, but these errors were encountered: