Closed cjsfj closed 7 years ago
Hi,
Thanks for the comment!
Not out of the box, but that is a good idea. Currently there is the onProgress
call but it doesn't guarantee to get every line (it probably should, and it should determine the difference between stderr and stdout).
Ill look into adding something.
Currently you can do:
$pool = new Pool([$p1, $p2]);
$pool->setOnProgress(function (Process $process, float $duration, string $last) {
printf("[pid:%d] %s", $process->getPid(), $last);
});
But it might miss some output, and will not differentiate between stdout and stderr.
I think I might change it to:
$pool = new Pool([$process1, $process2]);
$pool->setOnProgress(function (Process $process, float $duration, string $type, string $data) {
printf("[pid:%5d] (%s) %s", $process->getPid(), $type, $data);
});
$pool->run();
Which would produce something like:
[pid: 123] (err) Some text
[pid: 2412] (std) Some standard output
And add a different type of Console Output class to write it out with different colours and tags for each process.
Thanks for the quick response! I'll see what I can do with these examples.
Thinking through my use case... running 10 simultaneous processes, one would not necessarily know the PID of each process. So maybe at the beginning also have a way to print the pid:process command relationships?
Thank you again!
C
The PR: #12 should do what you need to do... You supply a set of tags for each process you add, these then get outputted for each process so you can tell them apart.
This looks good to me so far! Thank you!
Greetings -
Perhaps I'm missing something, but I am trying to see if it is possible to see the stdout of each process that is run in the pool.
Thanks,
C