kalama has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I am using a perl script to invoke an application which uses TCL file to init and run. The TCL script contains windows command typeperf.exe & , which runs in background of the application. I have multiple TCL scripts which i have to execute on the application. I am taking each TCL using foreach from the directory in which my TCL are stored. For each TCL , I am invoking the application using system command as : SYSTEM "Application.exe my.tcl". However after couple of iteration the perl script hangs the application, i have to kill my application to restart the script. The return value of system when i forcibly kill the application from $? is "1" (original value is 256). I have used $| to flush out my outputs to a file , but still the problem persists. Can anyone guide me in this regard ? I am using cygwin on windows to run my script. Thanks

  • Comment on SYSTEM Call of PERL hangs application when running a TCL script

Replies are listed 'Best First'.
Re: SYSTEM Call of PERL hangs application when running a TCL script
by Anonymous Monk on Jun 17, 2013 at 10:31 UTC

    The TCL script contains windows command typeperf.exe & , which runs in background of the application

    windows doesn't work like that, it doesn't run in the background, see Proc::Background

      Well , I am using following command in TCL :- exec typeperf -cf input.txt -si 1 -o output.txt & Now if i run the TCL script individually by in my application it works. Now i want to automate this process for executing multiple such scripts for which i am trying to use perl.

        and then what happened?

        You say SYSTEM Call of PERL hangs application when running a TCL script

        hang means it doesn't run in the background

        If you want to run it in background use Proc::Background

Re: SYSTEM Call of PERL hangs application when running a TCL script
by kalama (Initiate) on Jun 19, 2013 at 06:01 UTC
    Just an update :-
    As a workaround of the problem , i ran my typeperf.exe command in my perl script instead of individual TCLs. The automation now works fine , but am still not able understand why it was failing with original code.

    For running in background i am using

    system (1,"typeperf -si 1 -o output.txt") ;