Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a perl program running in windows that forks a child process. The child process opens a file handle $fh and starts some work with the file.
A short while later the parent forks a second child process. Much to my surprise the file opened in the first child is also opened in the second child according to process explorer (although I doubt the file handle created in the first child is shared) The first child finishes its work and closes the file handle and finishes. Annoyingly though the file stays open till the second child has completed and finished. I don't want this. The files are temporary and I need to be able to delete them without another child locking them.
I know that file handles are passed from parent to child processes. I wasn't expecting anything created in 1 child being locked by the second though.
Any help much appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File handles with forked processes
by BrowserUk (Patriarch) on Oct 10, 2015 at 00:05 UTC | |
|
Re: File handles with forked processes
by Anonymous Monk on Oct 09, 2015 at 23:38 UTC | |
by mvaline (Friar) on Oct 10, 2015 at 02:05 UTC | |
|
Re: File handles with forked processes (SetHandleInformation)
by tye (Sage) on Oct 11, 2015 at 22:07 UTC | |
by BrowserUk (Patriarch) on Oct 11, 2015 at 23:14 UTC | |
by tye (Sage) on Oct 12, 2015 at 01:55 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |