Jump to content

Process checking


schadek
 Share

Recommended Posts

In general I'm trying to halt execution until a complete program installation completes. I'm running a process called setup.exe that spawns msiexec.exe processes. I'm not sure how many of these actually get spawned. I can't use the RunWait with setup.exe because it ends before the msiexec.exe processes have finished. Any idea how I can monitor for spawned processes of a known running process and halt execution until they are done. I'm familiar with all of the process and run functions.

Link to comment
Share on other sites

Most of the time even after the install is done one msiexec.exe stays loaded for some time.

http://www.autoitscript.com/forum/index.ph...mp;#entry215406

This thread shows how to find the parent process ID for all processes. I suppose what you could do is start creating a tree of processes by scanning all processes to get their parents, starting with your forked process then all of it's children, iteratively on downward. Then mark any discovered processes as children to wait for.

Note that non-root/non-leaf processes in the middle of the tree can exit while leaving their children intact. I'm not sure what happens then, but I suspect the children are adopted by another process having to do with the session or the system. Hmm, google says the parentprocessid doesn't change and it may point to a terminated process.

Keep checking on a regular basis adding any new children and removing any exited children until all subtrees or former subtrees finally exit.

-brendan

Link to comment
Share on other sites

http://www.autoitscript.com/forum/index.ph...mp;#entry215406

This thread shows how to find the parent process ID for all processes. I suppose what you could do is start creating a tree of processes by scanning all processes to get their parents, starting with your forked process then all of it's children, iteratively on downward. Then mark any discovered processes as children to wait for.

Note that non-root/non-leaf processes in the middle of the tree can exit while leaving their children intact. I'm not sure what happens then, but I suspect the children are adopted by another process having to do with the session or the system. Hmm, google says the parentprocessid doesn't change and it may point to a terminated process.

Keep checking on a regular basis adding any new children and removing any exited children until all subtrees or former subtrees finally exit.

-brendan

Thanks, I'll investigate this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...