473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Problem with reading from StandardOutput

Hi,
Through my VB .NET code , I am trying to invoke a perl script. My aim
is to write lines to the script and read from it.
With ProcInfo
.Arguments = Enricher.EnrichScript + " " + enArgs
.RedirectStandardInput = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.UseShellExecute = False
.CreateNoWindow = True
End With

Me.EnrichProcess.StartInfo = ProcInfo
Me.EnrichProcess.Start()

The effective invocation is C:\perl\bin\perl a.pl 1 2 3.

I am able to write one line to the script, which reaches the script
properly:
Me.EnrichProcess.StandardInput.WriteLine("ABC")
After this the VB .NET program tries to read a line
stat = Me.EnrichProcess.StandardOutput.ReadLine()
This statment hangs.

The script when run manually at command prompt, immediately outputs a
string and a newline character after reading a line. But when invoked
programmatically , the ReadLine hangs( blocks).

Can somebody point out the problem?

Thanks
Yash
Nov 20 '05 #1
1 1463
* ya****@yahoo.com (Yash) scripsit:
Through my VB .NET code , I am trying to invoke a perl script. My aim
is to write lines to the script and read from it.
With ProcInfo
.Arguments = Enricher.EnrichScript + " " + enArgs
.RedirectStandardInput = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.UseShellExecute = False
.CreateNoWindow = True
End With

Me.EnrichProcess.StartInfo = ProcInfo
Me.EnrichProcess.Start()

The effective invocation is C:\perl\bin\perl a.pl 1 2 3.

I am able to write one line to the script, which reaches the script
properly:
Me.EnrichProcess.StandardInput.WriteLine("ABC")
After this the VB .NET program tries to read a line
stat = Me.EnrichProcess.StandardOutput.ReadLine()
This statment hangs.

The script when run manually at command prompt, immediately outputs a
string and a newline character after reading a line. But when invoked
programmatically , the ReadLine hangs( blocks).


Does this sample work?

<http://www.mvps.org/dotnet/dotnet/samples/miscsamples/downloads/RedirectConsole.zip>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: CMG | last post by:
I am trying to run gocr from my program, and use the output. I have done this with success befor, with a workaround command line tool.: Private irfanview As String = "C:\program...
2
by: dansan | last post by:
I have been tryning to make some of our C# programs talk to some perl programs. These perl jewels output in binary. I have been trying to use Process.StandardOutput to read the output from the...
2
by: palaga | last post by:
Hi I'm starting an external process that writes data to stdout, and I want to get back these data. So I use myProcess.StandardOutput (everything is correctly set, I can read the data). to read...
4
by: Eric ST | last post by:
Hi there, I run a process that run ftp.exe -s i get the StandardOutput this way : ftpProgram = Process.Start(ftpProgram.StartInfo) Output = ftpProgram.StandardOutput.ReadToEnd...
0
by: CMG | last post by:
I am trying to run gocr from my program, and use the output. I have done this with success befor, with a workaround command line tool.: Private irfanview As String = "C:\program...
0
by: mikepl746 | last post by:
I'm trying to run the svn command in a System.Diagnostics.Process to parse the StandardOutput. If I run the command in a CMD window while Regional settings are set to Japanese I see something like...
5
by: =?Utf-8?B?Z215ZXJz?= | last post by:
Hello, I am attempting to start a cmd.exe process and pass several .vbs scripts (with additional parameters) and then read the output from the scripts and make "notes" in a DataTable (the...
3
by: bob_jeffcoat | last post by:
Hi, I'm trying to read the output and write the input of a process using its StandardOutput/Input and I'd really like to check if the process is waiting for input or whether it has output ready...
1
by: =?Utf-8?B?Sm9uYXRoYW4=?= | last post by:
I have WinXP Pro SP2 and VS2005 SP1. I'm converting my projects from VS2003 to VS2005 and I receive a lot of warnings in several projects. For example, to one of my projects (for example...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.