G
Guest
I am attempting to fetch data from an external process. It seems to work OK
with regular arguments, but not with switch arguments. Here is an example of
a failure:
===================================
ProcessStartInfo psi = new ProcessStartInfo("date","/t");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.CreateNoWindow = true;
process = new Process();
process.StartInfo = psi;
process.Start();
===================================
My Nunit test case returns this:
===================================
TestCase 'CleanCodeTest.IO.ExecProcessTest.TestOneSwitchArg'
failed: Expected string length 13 but was 27. Strings differ at index 0.
Expected: "Wed 6/20/2007"
But was: "*** date: invalid date `/t'"
===================================
The MSDN documentation for ProcessStartInfo.Arguments sheds no light on
this; it is extremely sparse, essentially providing just an example and no
descriptive text.
with regular arguments, but not with switch arguments. Here is an example of
a failure:
===================================
ProcessStartInfo psi = new ProcessStartInfo("date","/t");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.CreateNoWindow = true;
process = new Process();
process.StartInfo = psi;
process.Start();
===================================
My Nunit test case returns this:
===================================
TestCase 'CleanCodeTest.IO.ExecProcessTest.TestOneSwitchArg'
failed: Expected string length 13 but was 27. Strings differ at index 0.
Expected: "Wed 6/20/2007"
But was: "*** date: invalid date `/t'"
===================================
The MSDN documentation for ProcessStartInfo.Arguments sheds no light on
this; it is extremely sparse, essentially providing just an example and no
descriptive text.