Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Invoking the Windows command line for selected directories

by BrowserUk (Pope)
on Nov 27, 2006 at 18:39 UTC ( #586307=note: print w/ replies, xml ) Need Help??


in reply to Invoking the Windows command line for selected directories

Any ideas ?

Make that last line system( 1, $BAT_FILENAME); and the script will terminate leaving the shell running.


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.


Comment on Re: Invoking the Windows command line for selected directories
Download Code
Re^2: Invoking the Windows command line for selected directories
by spurperl (Priest) on Nov 28, 2006 at 15:00 UTC
    This works ! But unfortunately I don't understand how :-(

    Can't find anything coherent in the documentation of system and exec. perldoc just says:

    If there is more than one argument in LIST, or if LIST is an array with more than one value, starts the program given by the first element of the list with arguments given by the rest of the list.
    Although this only makes things less clear.

    Where can I read the documentation about your solution ?

      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.
        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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://586307]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-09-24 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (246 votes), past polls