I am working on a method in a DLL. In my method, I wrote to the event log so that I can determine if things work as I expect. One of the tasks that I perform in the method is to create a process and run a command line application, and I want to be able to write the output of this, which is usually written to the console and writes it to the event log.
the code:
Process getNextIons = new Process(); getNextIons.StartInfo.FileName = @"""C:\Program Files\OpenMS- 1.6\PrecursorIonSelector.exe"""; getNextIons.StartInfo.Arguments = @"-ini ""C:\Program Files\OpenMS-1.6\precursorionselector.ini"""; getNextIons.StartInfo.UseShellExecute = false; getNextIons.StartInfo.RedirectStandardOutput = true; getNextIons.Start(); getNextIons.WaitForExit(); System.Diagnostics.EventLog.WriteEntry("FMANWiff", "IPS: " + getNextIons.StandardOutput.ReadToEnd());
I have a console test application that calls my method, and when I do this, I can see that the process was started and started correctly, however, when I actually try to use the DLL without using the test application, all I I see this entry:
IPS: and none of the output. I can say that it works, since I can see how the number of output files is updated.
Does anyone know why I am not getting any result and how can I fix it?
Travis
source share