Notifies caller of writes to the std::err or std::out
Syntax
Event Data
The event handler receives an argument of type ProcessOutputEventArgs containing data related to this event. The following ProcessOutputEventArgs properties provide information specific to this event.
Property | Description |
---|
Data | Returns the line of text written to standard out/error |
Error | Returns true if the line of text was written to std::error |
Example
Library/Library.Test/TestScriptRunner.cs
C# | Copy Code |
---|
using (ScriptRunner runner = new ScriptRunner(ScriptEngine.Language.JScript, @"WScript.StdOut.Write(WScript.StdIn.ReadAll());"))
{
StringWriter sw = new StringWriter();
runner.OutputReceived += delegate(object o, ProcessOutputEventArgs e) { sw.WriteLine(e.Data); };
runner.Start();
runner.StandardInput.WriteLine("From JScript");
runner.WaitForExit();
Assert.AreEqual(0, runner.ExitCode);
Assert.AreEqual("From JScript", sw.ToString().Trim());
} |
VB.NET | Copy Code |
---|
Using runner As New ScriptRunner(ScriptEngine.Language.JScript, "WScript.StdOut.Write(WScript.StdIn.ReadAll());")
Dim sw As New StringWriter()
runner.OutputReceived += Function(o As Object, e As ProcessOutputEventArgs) Do
sw.WriteLine(e.Data)
End Function
runner.Start()
runner.StandardInput.WriteLine("From JScript")
runner.WaitForExit()
Assert.AreEqual(0, runner.ExitCode)
Assert.AreEqual("From JScript", sw.ToString().Trim())
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also