I am looking at the
TerminalService and I am wondering how I can attach a terminal to a process that was not started from the UI. I saw that
start() only takes a
terminalId but I can’t see a way to attach to a running process. In our case we want to start a process when the container is started, and then when the UI (Theia) loads, we would like to attach to that process. Is this possible?
[original thread by Dominic E.]
Hi, i think the process has to be started via Theia, otherwise Theia does not have a chance listen to process streams.
I don’t know Node.js api allowing attachment to an existing process.
if you start the process in tmux you can always attach to the tmux session
Ah yea, that’s a good idea using tmux for this. Thanks for the tip.
You can start processes on Theia start up before a client connects using
@theia/process package, i.e. use
IShellTerminalServer to create a terminal process and
ProcessManager to access it. You can also add an http endpoint to start a new terminal process on a request. When a client connects it can fetch a terminal id and attach to it.
Great ideas Anton! Thanks for your input. I will have a look at all of them.
Hello @akosyakov, how can i get the instance of ‘IShellTernimalServer’ in the backend?
I try to inject it,
but it fails by the error:
And i use ‘ShellTerminalServerProxy’,
it goes wrong too,
@PeimingMo1 have you tried injecting the
It is bound this way:
Yes, it works, thank you.