StandardOutput Redirect problem.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • darren

    #1

    StandardOutput Redirect problem.

    I have a perl script that I am calling from vb.net as a process. I need to get the standard
    output and display it in a text box. The problem I am having is that extra blank lines are
    being added to the standard output, 2 of them per line. I have no idea why - and if I
    run the same script in the command line the output is normal (no extra 2 lines per line).
    Can someone point me in the right direction? Thanks.

    Dim MyProcess As New Process
    MyProcess.Start Info.UseShellEx ecute = False
    'redirect the standard output
    MyProcess.Start Info.RedirectSt andardOutput = True
    'do not create a command window
    MyProcess.Start Info.CreateNoWi ndow = True
    'set the file name
    MyProcess.Start Info.FileName = "c:\perl\bin\pe rl.exe"
    MyProcess.Start Info.Arguments = "e:\test_templa te.pl"

    'start the process
    MyProcess.Start ()

    'grab the contents of the standard output
    Dim srOut As StreamReader = MyProcess.Stand ardOutput

    Dim sOut As String = srOut.ReadToEnd

    txtText = sOut

    'wait until the program exits
    MyProcess.WaitF orExit()
Working...