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

Re^2: Multiple system commands in parallel

by SimonPratt (Friar)
on May 10, 2016 at 13:52 UTC ( [id://1162629]=note: print w/replies, xml ) Need Help??


in reply to Re: Multiple system commands in parallel
in thread Multiple system commands in parallel

Which version of Windows are you using and what code did you write?

I ask this because on Windows 10, the following works perfectly:

a.pl:

use 5.16.2; system "start perl a.plx"; system "start perl a.plx"; system "start perl a.plx"; my $i = 1; say $i++ while sleep 1;

a.plx:

use 5.16.2; my $i = 1; say $i++ while sleep 1;

The reason this works in Windows is because start spawns a new command prompt instance, completely detached from the parent instance. This separate instance can be terminated separately with ctrl-c, so if you're looking for something that is unkillable, you will have to look elsewhere (such as firing the code under a different user account, where the logged in user has no rights to terminate software running under the alternate account)

Replies are listed 'Best First'.
Re^3: Multiple system commands in parallel
by Anonymous Monk on May 10, 2016 at 20:41 UTC

    Windows 7

    Im just trying to have it basically spawn a separate process in the background. defiantly dont need a separate command window that it opens in. I even tried 'start /B'. but even that gets killed if the parent is <ctrl><c> out of.
      defiantly dont need a separate command window that it opens in.

      May be you don't need it but, if you use /min, it is completely unobtrusive and will disappear when the process does.

      If you really need to avoid the window, then you'll have to work out how to use Win32::Process and the appropriate combination of these flags:

      CREATE_DEFAULT_ERROR_MODE CREATE_NEW_CONSOLE CREATE_NEW_PROCESS_GROUP CREATE_NO_WINDOW CREATE_SEPARATE_WOW_VDM CREATE_SUSPENDED CREATE_UNICODE_ENVIRONMENT DEBUG_ONLY_THIS_PROCESS DEBUG_PROCESS DETACHED_PROCESS

      Or I could show you...but nah.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-24 04:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found