in reply to Re^2: SYSTEM Call of PERL hangs application when running a TCL script
in thread SYSTEM Call of PERL hangs application when running a TCL script

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

  • Comment on Re^3: SYSTEM Call of PERL hangs application when running a TCL script

Replies are listed 'Best First'.
Re^4: SYSTEM Call of PERL hangs application when running a TCL script
by kalama (Initiate) on Jun 17, 2013 at 11:14 UTC
    Ok, i will be a more descriptive this time ...

    Say my application name is test.exe.
    To run the application i use input1.tcl.

    When i run the application individually using tcl , I can see from task manager of windows that test.exe is running and once my tcl completes , the .exe file is killed.

    This input1.tcl also contains typeperf command running in background as mentioned below. Once the TCL is run . i kill the typeperf forcibly using "exec TASKKILL typeperf.exe" written at the end of input1.tcl.

    Now i have multiple such TCL's which i have run on same test.exe. I am writing something like below :-
    foreach $tcl (list_of_tcls)
    {
    system ("test.exe", "TCL:$tcl" );
    }
    What this is doing is that i invokes a new process for test.exe on every iteration. Once the tcl is complete , it automatically terminate the test.exe.
    But after few iterations , i can see that test.exe has begun to run , but it is not completing its execution. test.exe just sits there (this is what i meant by hang).
    I forcibly kill the process from task manager , and then the perl again starts the scripts from last iteration.

      Ok, so test.exe is doing something you don't want -- not much you can do about it from perl

      You can use Proc::Background to attempt to determine when it has hanged , and kill it if its been too long, instead of manually killing it, other than that, I've got no recommendations (debug test.exe sounds, well , like it sounds):)

        Well the thing here is the perl code , or application test.exe works fine when i executed the automation perl code having TCLs without "typerperf.exe".
        The application runs fine when i use to tun each test case individually.
        In short test.exe works fine.
        Also if we consider typeperf.exe as a background process here , i can see that when test.exe hangs , typeperf-exe isn't executed or shown in task manager.
        Again this scenario is random in sense that test.exe hangs at say third iteration or can hang at 5th or even in first iteration itself.
        It is this randomness that is not allowing me to locate the problem.
        The "debug" tht i came up is with observing the return value of SYSTEM when i manually kill test.exe which is 1 (and not 0 which is for successful fork and wait).
        So i am assuming the problem is in SYSTEM function and/or its execution.
        I have given a try using autoflush , but it didnt work out.
        So any furthur help ????