我正在尝试从 perl 脚本执行 C# 4.0 控制台应用程序并尝试捕获应用程序的输出。C# 应用程序是一个多线程应用程序,但它使用普通的 Console.WriteLine() 函数将输出写入控制台。
为了获取输出,我使用 perl 中的 `` 方法:
my @commands = `app.exe param1 param2`
但是当我运行脚本时出现错误:
Unhandled Exception: System.IO.IOException: The handle is invalid.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.Console.SetCursorPosition(Int32 left, Int32 top)
at Netapp.CmDownload.Processor.DownloadProcessor.Start(String[] args)
at Netapp.CmDownload.CmDownload.Main(String[] args)
终止应用程序。
注意:C# 应用程序是在 .Net Framework 4.0 上运行的 64 位应用程序,我尝试使用活动 perl 64 位和 32 位版本运行脚本,但没有任何效果。