I am looking for a way to read terminal output message, but after I have searched the theia community, it seem that we can not get output message from terminal.like this link says Read the terminal text · Issue #6004 · eclipse-theia/theia · GitHub.
before I use terminal, I create my process in backend use spwan from child_process.and I get output messsage from stdout, as follow shows
now I am not sure is it possible to pass my process to frontend terminal and I can both show terminal widget in frontend and get ouput message from backend.
it seem that many people want to get the terminal ouput message from the disscussion of theia community. and in fact in real life project terminal output message is very useful for following data process.could you conside develop a way to access the terminal message?
@wss On the frontend, you could just spawn a terminal via
TerminalService#newTerminal and create a callback for the
onData event. Then, you can just pass in a command via
Note that the terminal is interactable that way, and users can abort the process.
I find one method to implement both listening output message in backend and show terminal widget in frontend.
after looking at theia source code, I find terminal widget start method invoke ShellTerminalServer’s create method which in fact create a shellprocess, shellprecess is a TerminalProcess which has an outputStream, output represent the stdout
so get terminalprocess by processmanager, I can listening data event of the stdout
1.create ternimal widget with terminalService in frontend
2.create a service in backend listening outputstream on data event
Sure, that looks reasonable as well