in reply to Re^3: Running a perl script as a system command in another thread hangs while main thread reading from STDIN
in thread Running a perl script as a system command in another thread hangs while main thread reading from STDIN

Tried as you suggested, and there was no change at all :/

C:\>test.pl 1 ### Running a perl script ### 0s : Thread 0 - > Creating threads 0s : Thread 1 - Created 0s : Thread 2 - Created 0s : Thread 3 - Created 1s : Thread 0 - All Threads created 1s : Thread 0 - > Waiting for input now. All threads should finish now + without pressing enter 3s : Thread 1 - Starting 'perl -le "print \"hello world\""' 3s : Thread 2 - Starting 'perl -le "print \"hello world\""' 3s : Thread 3 - Starting 'perl -le "print \"hello world\""' 17s : Thread 0 - > Input received, all done 17s : Thread 2 - Finished the command: hello world 17s : Thread 3 - Finished the command: hello world 17s : Thread 1 - Finished the command: hello world 17s : Thread 0 - All Threads joined
  • Comment on Re^4: Running a perl script as a system command in another thread hangs while main thread reading from STDIN
  • Download Code

Replies are listed 'Best First'.
Re^5: Running a perl script as a system command in another thread hangs while main thread reading from STDIN
by BrowserUk (Patriarch) on Sep 30, 2014 at 02:40 UTC

    Could you post the output from perl -V on the affected system?


    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".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I included that in my first reply to you, but I will add it in to my original post for clarity. Both 2012 systems are using active state perl 5.18.2
      C:\>perl -v This is perl 5, version 18, subversion 2 (v5.18.2) built for MSWin32-x +64-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2013, Larry Wall Binary build 1801 [297964] provided by ActiveState http://www.ActiveSt +ate.com Built Feb 24 2014 11:06:47 Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
        I included that in my first reply to you

        Yes. But subsequent to that you discovered that at least som of your systems no longer displayed the symptoms; hence my asking for "the output from perl -V on the affected system?

        My hope was that it might be using some olther version of Perl that might explain the difference.

        Anyhow, I cannot reproduce your problem on my system with any of the versions of perl I have available (including 5.18) and I don't have access to a 2012 OS; nor can I posit any reason for the behaviour you are showing outside of some wrapper environment (eg. "built in shell of Komodo Edit").

        As the problem seems to be related to the version of the OS you run the code on rather than Perl itself; my best suggestion is to look there for differences -- eg. permission differences that might affect the inheritance of open handles or some such.

        Another possibility would be to try substituting a piped-open for the backticks; or perhaps look at using Win32::Process to give you more control over the thing.

        Or, if you have a MS support contract, try contacting them to see if they are aware of any differences in the OSs that might explain the symptoms.

        Sorry for the hand-wavey reply, but nothing I am aware of begins to explain what you are seeing on this limited set of systems.


        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".
        In the absence of evidence, opinion is indistinguishable from prejudice.