Support the ability to output to console while the command getting executed#56
Support the ability to output to console while the command getting executed#56hAbd0u wants to merge 1 commit intomikehaertl:masterfrom
Conversation
|
|
||
| echo $return_message; | ||
| } | ||
| } |
There was a problem hiding this comment.
This block would not work as expected: In blocking mode, this part is not reached until the command ist complete. If we want to introduce such a feature it only makes sense for nonBlockingMode.
| while (($out = fgets($pipes[1])) !== false) { | ||
| $this->_stdOut .= $out; | ||
| if($this->streamOutput) | ||
| echo $out; |
There was a problem hiding this comment.
This assumes that there's always a console (tty) connected. But this may not always be the case. Echoing out here also limits the way this feature can be used. It would be much more flexible if we would accept a stream here (e.g. STDOUT, STDERR, ...). This would be similar to what we do with stdIn. So a better way would probably be, to add setStdOutStream() and setStdErrStream() and then write to the streams here and below.
As this change is not so trivial and there's already a lot going on here, we need to test that nothing breaks.
I can maybe try to implement it that way - but can't promise yet if I find time soon.
Currently if a command is getting executed and that takes long then we will never know if it hangs, or still running, even if we want to show the progress it is hard to implement.
My PR is addressing this feature, basically we make
execute()simulate the behavior of real command gets executed in shell, while still running, the output of command will be echo to console.