473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Child Processes of Child Processes

5
My python script launches program A. Program A launches program B. Program A closes without waiting for program B to complete. How can I know when program B completes?

This is on a Windows XP machine. Thanks!
Mar 21 '08 #1
4 1787
My python script launches program A. Program A launches program B. Program A closes without waiting for program B to complete. How can I know when program B completes?

This is on a Windows XP machine. Thanks!
The script that launches the program A is the parent of program and A launches another program B which is the grandchild of the main script. I believe that since that A launches B the process for A is still on the run,if A terminates then B must also terminate unless its launched as a orphan process or a daemon process. B returns a exit status to its parent A stating that its job is done. we can catch the exit status of the program once its completed or to know that its successfully completed.
Mar 25 '08 #2
ldb88
5
Thanks for replying.

I'm not sure how program A launches program B, but I managed to find a way to get the pid of process B.

The only problem is that os.waitpid(pid, 0) doesn't work. It says no child process, but in the documentation I see that any pid should work, whether it is a child or not.

Is there something special I have to do with the pid for it to work? The pid I am using is the one that the Task Manager shows.

Thanks.
Mar 27 '08 #3
micmast
144 100+
I don't know how the code looks, but you might want to consider using popen, that contains a pid for the child processes. Also the program can wait for the program to finish before continuing it's execution (termination).
Mar 27 '08 #4
ldb88
5
I'm been running this from Cygwin, but giving it the Windows pid. Is there a way to specify that I want to wait for a Windows pid without having to exit Cygwin, reopen, and then continuing?

EDIT: Actually, that won't work either. I can't wait for a pid whether I go through cygwin or cmd.exe.
Mar 27 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Markus Franz | last post by:
Hi. I created a little script: for currenturl in sys.argv: pid = os.fork() if pid == 0: signal.alarm(10) do_something() # placeholder for the download and print routine
6
by: Bob Swerdlow | last post by:
My application starts up a number of processes for various purposes using: self.popen = popen2.Popen3("/usr/local/bin/python -O "myscript.py") and then shuts them down when appropriate with...
2
by: Rech | last post by:
Hi, I need a little help here managing child processes in Python. I'm not so skilled in system programming so I hope you can give me some good suggestions. I have a very CPU and memory...
22
by: Jason Zheng | last post by:
This may be a silly question but is possible for os.wait() to lose track of child processes? I'm running Python 2.4.4 on Linux kernel 2.6.20 (i686), gcc4.1.1, and glibc-2.5. Here's what happened...
2
by: rocco.rossi | last post by:
I'm using the Python processing module. I've just run into a problem though. Actually, it's a more general problem that isn't specific to this module, but to the handling of Unix (Linux processes)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.