home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7624 < prev    next >
Encoding:
Text File  |  1992-12-29  |  1.8 KB  |  57 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!florida!essbaum
  3. From: essbaum@rchland.vnet.ibm.com (Alexander Essbaum)
  4. Subject: can't get pid
  5. Sender: news@rchland.ibm.com
  6. Message-ID: <1992Dec29.164941.21995@rchland.ibm.com>
  7. Date: Tue, 29 Dec 1992 16:49:41 GMT
  8. Disclaimer: This posting represents the poster's views, not necessarily those of IBM
  9. Nntp-Posting-Host: florida.rchland.ibm.com
  10. Organization: IBM Rochester
  11. Lines: 44
  12.  
  13. hi.  hopefully this will make sense:
  14.  
  15. i'm trying to wait for a process called from inside perl via
  16.  
  17.    open (apl2,"$apl2command|");
  18.  
  19. or
  20.  
  21.    `$apl2command`;
  22.  
  23.  
  24. $apl2command calls a ksh script that executes an apl2 interpreter with
  25. some parameters.  problem is, it seems the shell that calls the apl2 command
  26. exits immediately even though the apl2 command takes 1 minute to run.
  27.  
  28. if i do
  29.  
  30.    $apl2id = open (apl2,"$apl2command|");
  31.    print `ps -fp $apl2id`;
  32.    waitpid ($apl2id,0);
  33.  
  34. i get
  35.  
  36.    USER   PID  PPID   C    STIME    TTY  TIME CMD
  37.  essbaum 21931 17054  16                  0:00 <defunct>
  38.  
  39. and the shell that "$apl2command" ran in seems to go away (no "waiting").
  40.  
  41. while this is running, i can see (via ps alx) that the process i REALLY
  42. want to wait for is created and its parent is another process who's PPID
  43. is 1.  apparently the shell from "open" goes away and the ksh that runs
  44. apl2 gets adopted by init.  does this make sense?  any idea what might
  45. cause this or how i can stop it?
  46.  
  47. basically, i need to wait for the apl2 process to finish before i go on,
  48. but i can't seem to get my hands on the PID of that process.  i'd rather
  49. not use ps and try to guess which process is the right one... (there could
  50. be multiple apl2 processes, etc.  i'd have to look at times and stuff.
  51. yuk. )
  52.  
  53. thanks in advance for any help!
  54.  
  55. axel
  56.  
  57.