简体   繁体   中英

lauch perl process from C# and read standard output

I have a some C# code which launches a perl script. The perl script then has its own child processes.

The problem im having is that when i try to read the standard output, C# waits for all of the perl child processes to complete then returns all of the output.

Is is possible to dynamically read the standard output of all the Perl child processes dynamically?

->C# process 
   ->Perl process
     -> Perl child process
     -> Perl child process
     -> Perl child process

When running the perl script in cmd, all output is correct.

Why not run the master perl process via C#, and then get an array of System.Diagnostic.Process by searching for process on name, as they'll all be running as "perl"

Process [] localByName = Process.GetProcessesByName("perl");

Then iterate through the array and use as a standard System.Diagnostic.Process to get the output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM