Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Like in Unix, each file handle also has a bit saying whether or not it should be inheritted by another program.

In Unix it is called the "close-on-exec flag", can be controlled by fcntl() with F_SETFD, and (as the name implies) takes effect on exec since a forked child always inherits all open file handles.

In Windows it is just the "inherit flag" for the file handle, is initially set by the bInheritHandle field of the SECURITY_ATTRIBUTES struct argument to CreateFile() (and defaults to "don't inherit" if this argument is NULL), can be changed using SetHandleInformation() with HANDLE_FLAG_INHERIT, and takes effect when a new process is created [for example, via CreateProcess()].

If you create a process with the bInheritHandles parameter of CreateProcess() specified as TRUE, then that process will inherit only those handles that have their "inherit bit" set to TRUE. If you specify bInheritHandles as FALSE, then no handles are inheritted.

You should already have Win32API::File on your system so you can use SetHandleInformation() via it.

                - tye

In reply to Re: Win32::Process::Create and IO::Select bad interaction (SetHandleInformation) by tye
in thread Win32::Process::Create and IO::Select bad interaction by clintp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2021-12-04 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?