Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the ability to output to console while the command getting executed #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hAbd0u
Copy link
Contributor

@hAbd0u hAbd0u commented Mar 14, 2021

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.


echo $return_message;
}
}
Copy link
Owner

@mikehaertl mikehaertl Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -469,9 +475,13 @@ public function execute()
//
while (($out = fgets($pipes[1])) !== false) {
$this->_stdOut .= $out;
if($this->streamOutput)
echo $out;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants