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

Real time output #11

Closed
schmunk42 opened this issue Feb 29, 2016 · 8 comments
Closed

Real time output #11

schmunk42 opened this issue Feb 29, 2016 · 8 comments
Labels

Comments

@schmunk42
Copy link
Contributor

Is there a way to show the realtime output of a long running command on the console?

Similar to what's described here.

@mikehaertl
Copy link
Owner

Hmm, no and I currently don't really have plans to implement something like this. Would have to think about a nice and easy OO interface first. But let's keep it open as a feature request. But I would not wait for it ;).

@schmunk42
Copy link
Contributor Author

Draft for discussion: schmunk42@1606eef

CC: @phpnode

@schmunk42
Copy link
Contributor Author

From the discussions in the commit:

Yes, sure. Just fetch the final command string from getExecCommand().

Great :) So this is basically just a little example for the docs.

@Antoniossss
Copy link

Antoniossss commented May 20, 2016

+1 - live output is needed for example on long running processes. My proposition of solving this is in https://github.com/Antoniossss/php-shellcommand/tree/issue-11-live-output fell free to fetch those changes. As a feature requirement I am using that code right now.

Output to stdout is only on demand, and output is still buffered and available as a whole after process finishes.

Another solution would be to expose additional output pipe for the user to fetch directly from the stream insteed of echoing everything right away, or even allow user to define his own stream that output should be piped to.

@schmunk42
Copy link
Contributor Author

Another solution would be to expose additional output pipe for the user to fetch directly from the stream insteed of echoing everything right away, or even allow user to define his own stream that output should be piped to.

That sounds nice to me.

@mikehaertl
Copy link
Owner

How about a callback? You could configure it with the class and whenever there's a new output fragment the function is called. Would that make sense? If we do that, we should also think if we need different callbacks for stdout and sterr. I have to admit that I'm not really an expert on continuous output of commands. So more feedback welcome.

Another solution would be to expose additional output pipe for the user to fetch directly from the stream

Yes, that's what I also considered. But this again makes things ugly. Developers should not have to deal with pipes if possible.

@Antoniossss
Copy link

Antoniossss commented May 23, 2016

@mikehaertl Callback would also make sense and would satisfy both of us - there would be no direct output - just as you wanted, and I would have possibility to echo incoming data in realtime.
Also it would make sense to have stdOut callback and stdErr callback just in case if stdErr is not redirected to stdOut.
The flag to echo output I made can be simply replaced by the callback - if not null, pass current output to callback.

@mikehaertl
Copy link
Owner

Closing this as an implementation is far from trivial and would cause too many headaches. Also see my comment here: #27 (comment)

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

No branches or pull requests

3 participants