Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

obtaining child process ID

Status
Not open for further replies.

smugindividual

Programmer
Apr 14, 2003
104
US
given the pid of a process, does tcl have a command that returns the pids for any child processes?
 
Considering that the information isn't available until
fork() completes and that all information is then
available through the /proc(assuming SYSV) filesystem
under the pid dir listing, rolling a suitable procedure shouldn't be too difficult.
 
Tcl can give you the pid of all the processes it launched by [exec ... &].

From the exec page of the Tcl manual:
If the last arg is ``&'' then the pipeline will be executed in background. In this case the exec command will return a list whose elements are the process identifiers for all of the subprocesses in the pipeline. The standard output from the last command in the pipeline will go to the application's standard output if it hasn't been redirected, and error output from all of the commands in the pipeline will go to the application's standard error file unless redirected.

HTH

ulis
 
Thanks for the replies. I found that using [exec ptree $pid] will work best for what i'm trying to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top