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

Get the current process data like in Process class for subprocesses #16

Open
kabukunz opened this issue Apr 20, 2021 · 3 comments
Open

Comments

@kabukunz
Copy link

Actually it seems we can start a subprocess with Process class; but is there a way to get the current process data?
I'd like to read its env vars and get the running process name...
Thank you

@aslze
Copy link
Owner

aslze commented Apr 20, 2021

Current functionality allows reading/writing the subprocess' stdout/stderr/stdin as it runs. The process name is the name of the executable you run, isn't it? And reading its environment variables. Not sure if that is even possible on Windows. I'll check the docs and add that if it is possible. A subprocess inherits the parent process env vars. If it sets new env vars it could communicate them to the parent via stdout or somewhere else. I'll see if that can be "spied" from the parent.

@aslze
Copy link
Owner

aslze commented Apr 21, 2021

On Linux you can read some process's environment vars from /proc/<PID>/environ. But I can't find similar functionality on the Windows API. Do you know a way?

@kabukunz
Copy link
Author

kabukunz commented May 7, 2021

Stackoverflow points to a way using some command line trick:

https://superuser.com/questions/415360/how-do-i-find-out-command-line-arguments-of-a-running-program

while it seems the canonical way is by using win openprocess thru C:

https://stackoverflow.com/questions/4570174/how-to-get-the-process-name-in-c

But bear with me, I'm no windows expert al all...

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

No branches or pull requests

2 participants