You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extend System.Diagnostics.Process with a ParentProcess property #2763
Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues
It is unreasonably obscure to get the parent of a process via PowerShell today. Get-Command -Noun Process will not give you anything, and you have to know that
there is a ParentProcessId on Get-CimInstance win32_process. Even when you know that, you have to understand recycling of process ids and that you have to check the start time of the processes to actually know if it is your parent.
On top of that Get-CimInstance win32_process is dog slow due to some repetitive loading of mui dlls for some time zone related localization.
I suggest an extended property Diagnostics.Process ParentProcess {get;} that does the heavy lifting for the user in a fast and correct manner.
I don't know if it is valuable to also expose the ParentPid. (You were started by a process that had this id at the time when our your process started). Thoughts?
I'm getting a test error when Import/Export-CliXml with process after adding the Parent property to Process.
Is there any way to opt out a property from clixml serialization?
Issue-Enhancementthe issue is more of a feature request than a bugResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues
Activity
powercode commentedon Nov 22, 2016
I can't find what
src\System.Management.Automation\engine\Types_Ps1Xml.generated.csis generated from.Any hints?
powercode commentedon Nov 22, 2016
Or was it generated once upon a time, but isn't any longer?
powercode commentedon Nov 22, 2016
Initial (working on WinFull) at https://github.com/powercode/PowerShell/tree/process-parentpid
What's the deal here regarding platform differences?
I'm not really well versed enough to say how to implement this on Linux/maxos.
Pointers?
iSazonov commentedon Nov 24, 2016
The file's history say that you can modify it.
iSazonov commentedon Nov 24, 2016
Start from libpsl-native getcurrentprocessorid
I think you can easy add and use getppid
powercode commentedon Dec 6, 2016
getppid is just the parent of the current process.
I think I have to read /proc/pid/stat to get the ppid of a specific pid.
iSazonov commentedon Dec 7, 2016
Yes, read /proc right direction.
powercode commentedon Dec 7, 2016
I'm getting a test error when Import/Export-CliXml with process after adding the Parent property to Process.
Is there any way to opt out a property from clixml serialization?
lzybkr commentedon Dec 7, 2016
I don't know why the tests are failing in CI. I tried your changes it it works for me locally.
You can try debugging in CI. On AppVeyor, you can follow these instructions:
https://www.appveyor.com/docs/how-to/rdp-to-build-worker/