cancel
Showing results for 
Search instead for 
Did you mean: 

Using STM32_programmer_CLI.exe how can I capture the STD output?

bartj1
Associate III

Running in vb.net I can successfully load code to a target using a .bat file using:

System.Diagnostics.Process.Start("c:\rp:\boot.bat")

In the above case a command window is shown during the load with session information. It goes away when complete.

However, if I launch the bat file as a "process" and look for the STD output, I get nothing. However the "process" loads a file correctly.

 ' define a process

           Dim p As New Process

           p.StartInfo.FileName = "boot.bat"                 

           p.StartInfo.UseShellExecute = False

           p.StartInfo.RedirectStandardOutput = True

           p.StartInfo.RedirectStandardError = True

           p.StartInfo.CreateNoWindow = True

           p.EnableRaisingEvents = True

           Application.DoEvents()

           ' add a handler so we can easily display the data

           AddHandler p.OutputDataReceived, AddressOf Showme

           

           p.Start()

           p.BeginOutputReadLine()

           Application.DoEvents()

           ' spin here till done or cancel

           Do While (p.HasExited = False) And (CANCEL = False)

               ' monitor progress

               Application.DoEvents()

           Loop

       I never get an event on OutputDataReceived. Does the cli version issue standard output? If not, is there a good workaround?

Thanks!

2 REPLIES 2

Are you sure it's coming out of STDOUT (1) and not STDERR (2) ?

Piping the latter

foo 2>err.log

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
bartj1
Associate III

First...thank you for your response...

Two findings:

1) If I add:

p.StartupInfo.Arguments = "> " & Echofile

The file is correctly populated with the load session info.

2) If I add:

p.StartupInfo.RedirectStandardError = True

p. ErrorDataReceived, Addressof Showmeerror

I still never get a "hit" on the above event.

Any additional ideas?

Thanks