system() already wait()s for the child process. To get around this you are spawning a shell and telling the shell to spawn a child and not wait for it. So system() waits for the shell to finish and you are left with a grandchild process which gets adopted by "init" (PID 1) when its parent exits and you have zero children.
If you want to have "sleep 10" be a child that you can wait for, then you'll have to use fork (on platforms that have fork) or: system(1,"sleep 10"); (on platforms that support that) or something even more platform-specific like use Win32::Process.
- tye (but my friends call me "Tye")In reply to (tye)Re: need help on wait();
by tye
in thread need help on wait();
by Ras
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |