menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Theia

Eclipse Theia - Cloud & Desktop IDE

Channels
Team

How do I attach a terminal process that was not started from the UI?

March 30, 2019 at 12:37pm

How do I attach a terminal process that was not started from the UI?

March 30, 2019 at 12:37pm
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?

March 30, 2019 at 12:44pm
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
like-fill
1

March 30, 2019 at 8:07pm
Ah yea, that's a good idea using tmux for this. Thanks for the tip.

March 31, 2019 at 2:45am
You can start processes on Theia start up before a client connects using /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.
like-fill
1

April 1, 2019 at 8:34am
Great ideas Anton! Thanks for your input. I will have a look at all of them.
Edited