18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

_execute ignores synchronous flag

JohanJohan Members
edited November -1 in Sahi - Open Source
Hi

My script calls the _execute function a good 11 consecutive times (with _wait statements in between). In all cases, the second parameter is "true".

Now the first 9 calls are to batch files that terminate very quickly. For these, it looks like the second parameter is respected - but this could just be that the wait statement is long enough to fool me into it (the waits are 3 seconds).

The last two calls take much longer to complete (on the order of minutes). What I've noticed, is that SAHI continues on with the rest of my script while the last two calls to _execute still runs on the server! I can see the commandline windows are still open & spitting out info.

Therefore, I must conclude that the _execute command is broken, or I misunderstand something about its use, please can you clarify?

Regards,
Johan

Comments

  • narayannarayan Administrators
    Hi Johan,

    What is the command passed to _execute?
    If you execute the above command directly on a command prompt, does it exit before completion of the task?

    Regards,
    Narayan
  • From within the script, I run
    _execute($ToolsPath + "\\Tools\\rexec " + $host + " C:\\tools\\command.cmd " + $param1 + " " + $param2,  "true");
    

    When I run this one from the commandline, it exits immediately. Does rexec.exe have a parameter that makes it syncronous?
    rexec.exe 192.168.6.128 C:\\tools\\command.cmd param1 param2
    
  • narayannarayan Administrators
    Hi Johan,

    As you might have guessed, Sahi is going ahead because of rexec returning immediately. I am not much aware of rexec, but one website mentioned that -N could be used for interactive mode. I am not sure if this is the same rexec since the msdn site does not mention it. I am posting the two links nevertheless.

    http://www.mkssoftware.com/docs/man1/rexec.1.asp
    http://technet.microsoft.com/en-us/library/bb490989.aspx

    Regards,
    Narayan
  • Cool, thanks Narayan - I found PsExec, which looks like it will solve this problem. We're testing it now to see what it does.

    Here's the link:

    http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
Sign In or Register to comment.