By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,364 Members | 1,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,364 IT Pros & Developers. It's quick & easy.

Redirection of StandardInput

P: n/a
Hi, I've got this exception in my code. I'm starting new process with
Redirection of standart input.
As you cann see, I'm using log4net for logging the input stream...

What does this Exception meen ? How can I fix it ?
StringBuilder args1 = new StringBuilder();

args1.Append("-n" + localhost + " -u" + userName + " -p" + password);
Process myProcess = new Process();

myProcess.StartInfo.FileName = cdHome + "Direct.exe";

logger.Info("FileName = " + myProcess.StartInfo.FileName);

myProcess.StartInfo.Arguments = args1.ToString();

logger.Info("Args = " + myProcess.StartInfo.Arguments);

myProcess.StartInfo.UseShellExecute = false;

myProcess.StartInfo.RedirectStandardInput = true;

myProcess.Start();

// input

try

{

logger.Info("input streaming");

StreamWriter myStreamWriter = myProcess.StandardInput;

string[] procedData = File.ReadAllLines(prozessFile);

for (int i = 0; i < procedData.Length; i++)

{

logger.Info("StreamInpur -" + procedData[i]);

myStreamWriter.WriteLine(procedData[i]);

}

myStreamWriter.Close();

}

catch (Exception e)

{

logger.Error("Input stream - ", e);

}
2006-11-21 16:06:14,296 INFO Base - StreamInpur -SUBMIT
2006-11-21 16:06:14,296 INFO Base - StreamInpur -SENDFILE PROCESS
2006-11-21 16:06:14,296 INFO Base - StreamInpur -SNODE=SKA.RZ1
2006-11-21 16:06:14,296 INFO Base - StreamInpur -MAXDELAY=UNLIMITED
2006-11-21 16:06:14,296 INFO Base - StreamInpur ->
2006-11-21 16:06:14,296 INFO Base - StreamInpur -TASKC1 COPY
FROM(FI***@RE.U0000.P0.NCA1X SNODE)
2006-11-21 16:06:14,296 INFO Base - StreamInpur -TO (PNODE
FILE=C:\Temp\F655_rss-a2.txt DISP=(RPL))
2006-11-21 16:06:14,296 INFO Base - StreamInpur ->
2006-11-21 16:06:14,296 INFO Base - StreamInpur -PEND;
2006-11-21 16:06:14,296 INFO Base - StreamInpur -QUIT;


2006-11-21 16:06:29,343 ERROR Base - Input stream -
System.IO.IOException: The pipe has been ended.

at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.WriteCore(Byte[] buffer, Int32 offset, Int32
count)
at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean
flushEncoder)
at System.IO.StreamWriter.Write(Char[] buffer, Int32 index, Int32 count)
at System.IO.TextWriter.WriteLine(String value)
at CDTestingApp_StdIO.Test.StartConnectDirect()
Nov 21 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.