http://www.perlmonks.org?node_id=586489


in reply to Re^2: Invoking the Windows command line for selected directories
in thread Invoking the Windows command line for selected directories

Um. Off the top of my head, I don't know where it actually documented. It's one of those things that I picked up by osmosis through reading PM. Probably from tye. He's the source of most of the useful stuff regarding Perl and Win32 around here.

As for how it works, that's fairly easily explainable. It is a Win32-only special case coded into the sources. If the first argument to system is (exactly) '1', then the code adds the CREATE_NEW_PROCESS_GROUP flag to the creation flags parameter passed to CreateProcess(), which has the required effect of 'detaching' the process created from it's parent.

See also Re: How does system(1,"foo") work on Windows?.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^4: Invoking the Windows command line for selected directories
by spurperl (Priest) on Nov 28, 2006 at 16:13 UTC
    Ah, so it's CREATE_NEW_PROCESS_GROUP. In one of my attempts I tried the same using Win32::Process instead of system(), and looking through the flags I thought DETACHED_PROCESS might do the job (it doesn't). Strange that I didn't even notice CREATE_NEW_PROCESS_GROUP.

    Thanks

      DETACHED_PROCESS is used to create processes that don't have a console. They are 'detached' from the console; think *nix-style deamon processes and win32 services (though the latter can also have a console!).

      The gory details.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.