tomaswolf commented on issue #658:
URL: https://github.com/apache/mina-sshd/issues/658#issuecomment-2639143077

   > Currently, it is easy to find because each command produces a one-line 
output, but what will happen when the given command produces multiple lines of 
output?
   
   This is not a dumb question at all. It shows that the "protocol" for 
communicating with "bc" is badly defined since "bc" gives no indication where 
its output for a command ends. If "bc" gave a prompt whenever it expected 
input, it would be easier. (Such as writing "> " on stdout when it wants new 
input.) But it doesn't.
   
   I don't have the time to write this code for you. You'll have to figure it 
out yourself. The main thing is that your code has to keep consuming stdout and 
stderr, otherwise the command may hang when transport buffers are full. How to 
synchronize what is read from stdout and stderr with commands you send via 
stdin is then the application's business. (Same as with any 
`java.lang.Process`.) I can't write your application.
   
   As for providing complete examples: we don't have the resources to produce 
such examples. If someone provides PRs with high-quality examples, we can 
include them.
   
   As for `ChannelEvent.STDOUT_DATA` not working: first, I don't think it'd 
help for this problem (the problem is not when to read since the read will 
block anyway until data is available but to know when to stop reading, i.e., 
knowing which was the last line of the output for a particular command), and 
second, it looks as if this event is never produced in Apache MINA sshd. The 
latter might be a minor bug in the code; but the usefulness of that event is 
questionable anyway. The event was apparently introduced very long ago (before 
2008), but never implemented.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to