in reply to Multiple system commands in parallel

I personally would reach for Parallel::ForkManager and Capture::Tiny; and most certainly add use strict; and use warnings; :P Plenty of approaches and if this is a throwaway script, without a need to speed-limit, a simple fork might do.

Replies are listed 'Best First'.
Re^2: Multiple system commands in parallel
by BrowserUk (Patriarch) on May 09, 2016 at 22:43 UTC

    Under Windows, both P::FM and fork use threads; which doesn't address the OPs problem.


    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.

      The problem seems to be synchronous v asynchronous. Do threads run synchronously in WIN when paired with system? Is all that is necessary to use exec which Tanktalus already mentioned and I had, perhaps wrongly assumed, was already part of the advice here?

        Do threads run synchronously in WIN when paired with system?

        Obviously not; but did you read the OPs reply to Tanktalus?

        Any processes spawned by system, from threads or not, will run within the same console, thus will be aborted if the parent is aborted by ^c.


        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.
        Is all that is necessary to use exec

        Have you thought about what happens if you exec after a (pseudo-)fork?


        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.