On 5/7/07, Bill Luebkert <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hi!
> >
> > I have a Perl script that opens a number of DBM files. It also starts
> > other programs via calls to "system". I recently found out that the
> > "handles" to the DBM-files seem to be inherited by the newly started
> > process. I would like to avoid this. Does anybody know how to do this?
> >
[...]
>
> Try detaching the process and not inheriting :
>

Thanks for the suggestion.

I had hoped that there was some way of doing what I want without
having to use Win32 specific functions, such as the CreateProcess
function with it's "inherit" parameter. I need to have my scripts
working on Linux too. Perhaps I have to use CreateProcess on Windows
and maybe fork/exec on Linux (but the problem is smaller on Linux
where files are not locked just because of an extra open handle/file
descriptor).

But it would have been very convenient if "system" worked better. As
far as I can see the "handles" that are opened to access a pair of DBM
files, is of no use whatsoever in a child process. On Windows it just
causes the DBM files to be locked. And if I'm not mistaken each
"handle" on Windows has it's own flag HANDLE_FLAG_INHERIT. If that
flag is false the handle is not inherited even if the "inherit"
parameter to CreateProcess is true. So if Perl had chosen to set this
flag to false for the handles to the DBM files I wouldn't have my
current problems.

Is my reasoning correct, or am I missing something?

/Johan Holmberg
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to