Jump to content

Run with STDERR_CHILD and STDOUT_CHILD fails.


RLL
 Share

Recommended Posts

HI,

I'm running a simple "Run" script from windows that runs the dos "find" intrinsic.

$pid = Run(@Comspec & ' /k ' & $findCmd , "someStartupDirectory", @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)

thIs fails with a windows error box: "Findi String (grep) Utility has encountered a problem and needs to close. blah blah".

If I Run

$pid = Run(@Comspec & ' /k ' & $findCmd , "someStartupDirectory", @SW_SHOW)

it runs, the output in the dos window is correct.

Anybody have a clue as to what's wrong? Because the short Run command works, I'm not suspicious of the $findCmd string nor of the startupDirectory.

For some reason the hook into stderr and stdout is failing (my guess).

Ron

Link to comment
Share on other sites

I've gone a bit further.

I've changed $findCmd to run search.bat that turns echo on, echos the input, then runs dos "find".

search.bat

echo on

echo %1 %2 %3

find %1 %2 %3

Running this, I am getting stdout back from the child process (the echo output), but windows find is failing with the error window described above = no output from find.

I'll roll my own find in C/C++.

This may be trouble for others in the future.

Ron

Link to comment
Share on other sites

It would be most helpful if the whole script was posted, plus the contents of the batch file. Otherwise we're taking shots in the dark, considering $findcmd has no information for us to look at. Also, we could probably suggest ways of doing whatever it is you're trying to do without ever calling up a run command by using internal AutoIt commands to do whatever it is.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 3 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...