Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stderr stream

Status
Not open for further replies.

StevensD

Programmer
Apr 24, 2002
5
CA
I have created an exe to be called from the commandline. I would like to send any errors generated by this exe to the standard error stream so the data can be retrieved by the calling Exec object. What do I need to do to send this information?

This is the calling code.
Code:
Set oExec = oShell.Exec(test.exe)
oExec.StdErr.ReadAll

Careful. We don't want to learn from this. -- Calvin
 
This seems like it ought be easy, doesn't it. Sadly, VB applications are tagged as GUI-only apps, which means that whilst they are bootstrapping themselves through CreateProcess they actually delete any of the standard handles they might have inherited from the process that launched them.

In your case this means that a) there's no STDERR in the program being launched and b) even if you manage to create one, it won't be the one inherited from oShell, so even if you could write to it it isn't the one that your oExec can read from

Now, let's pretend that we somehow get an inherited set of standard streams from the process that launched the VB program you'll note that the two easy ways of communicatin with those streams (Windows Scripting Host and the FIleSystemObject) define STDERR as read-only...so you can't write to it.

Now, there are solutions that directly address the above - but you might be best off finding another way of approaching this; say writing to a temporary file, or perhaps named pipes.
 
Thanks for the reply. I guess I'll have to use a temporary file instead as you suggested.

Careful. We don't want to learn from this. -- Calvin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top