andyswarbs Posted March 7, 2006 Share Posted March 7, 2006 (edited) I have got into using this quite extensively. However some calls fail and some succeed. This is in a For...Next loop so it is unlikely to be a syntax error on my side. Also I have trapped the failure on a variety of other calls. Essentially the first one or two calls to the RUN function when $STDOUT_CHILD etc is specified works fine, and mostly the second one works. But the third, or 4th become dodgy. At one point I thought I had this down to every alternate call would fail, but it is not that simple. I was musing that there might be a race condition, such that my code: $Pid=Run($Cmd,$Dir,$Flag,$STDERR_CHILD+$STDOUT_CHILD) While True $OutText=StdoutRead($Pid) If @error=-1 Then ExitLoop $OutTextAll &= $OutText WEnd While True $ErrText=StderrRead($Pid) If @error=-1 Then ExitLoop $ErrTextAll &= $ErrText WEnd might fail because Run is an independent process. Further exhaustive tests show that there is a real runtime problem here. I have tried using processclosewait() on my PID, to no avail. Has anyone any insights? Right now I have put a loop saying "have I retrieved the data (since I knowit exists), if not then re-run the RUN command and get the output again! Not ideal obviously. Andy Edited March 7, 2006 by andyswarbs Licensing.au3Extended _Max & _Min_MsgBoxExitVarious extensions to _GuiCtrl...Run Dos programs output into an array etc (Updated 19-Feb-06)Extensions to Array library, primarily in two dimensions (updated 20-Feb-06)Version dependency calculator, _IsVer1GEVer2User Management, answering some domain questions (updated 19-Feb-06, various bugfixes and new functions added)Extensions to registry manipulation, including a recursive search & replaceDelimited string library (updated 19-Feb-03, added _DelimListSort)String library extensionsTerminal Server supportFile libraryCommand line parser (added 18-Feb-06)(UDF homepage) (Scit4Au3 UserCallTips added 21-Feb-06) Link to comment Share on other sites More sharing options...
DaveF Posted March 7, 2006 Share Posted March 7, 2006 Thanks for the bug report, but I'm not certain that I understand the issue that's being reported. You're reporting that in the cases that you're seeing the problem (making multiple calls to Run with the flags set to capture STDOUT and STDERR) that the call to Run fails and the script halts with an error? Or the script freezes? Or there's no output? It's difficult to understand without a complete script that demonstrates the error. Are you making making multiple calls to the same EXE and/or the same command line? What version of the beta are you using? Is the behavior the same if the script is compiled? On what version(s) of Windows does the error appear? Can you make a script that uses common Windows EXEs that demonstrates the problem? Could you share some of the details of your exhaustive testing? I was able to run this test script both compiled and not compiled on Win XP SP2 with the AutoIt3 beta 3.1.1.107 with no observed problems: expandcollapse popupDim $OutTextAll, $ErrTextAll $STDERR_CHILD = 4 $STDOUT_CHILD = 2 For $step = 1 to 4 Select Case $step = 1 $Cmd = @SystemDir & "\java.exe -verbose tootles noodles" $Dir = @SystemDir Case $step = 2 $Cmd = @ComSpec & " /c dir c:\bugjaw.baby" $Dir = "c:\" Case $step = 3 $Cmd = @SystemDir & "\netsh.exe dump" $Dir = @SystemDir Case $step = 4 $Cmd = @SystemDir & "\makecab.exe /v3 c:\bugjaw.baby c:\qwerty\uiop\bugjaw.cab" $Dir = @SystemDir EndSelect For $iter = 1 to 10 $OutTextAll = "" $ErrTextAll = "" $Pid=Run($Cmd,$Dir,@SW_HIDE,$STDERR_CHILD+$STDOUT_CHILD) While True $OutText=StdoutRead($Pid) If @error=-1 Then ExitLoop $OutTextAll &= $OutText WEnd While True $ErrText=StderrRead($Pid) If @error=-1 Then ExitLoop $ErrTextAll &= $ErrText WEnd MsgBox(0, "STDOUT was:", $OutTextAll) MsgBox(0, "STDERR was:", $ErrTextAll) Next Next Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
jpm Posted March 28, 2006 Share Posted March 28, 2006 As no answer tranfert to support forum incase the author want to continue the discussion Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now