cronvel / terminal-kit

Terminal utilities for node.js
MIT License
3.09k stars 200 forks source link

Embed a terminal from another process? #180

Open davidcallanan opened 3 years ago

davidcallanan commented 3 years ago

Hey, first of all amazing package!

I was wondering if it is possible to embed another process into the current process's terminal?

For example this package allows you to open a terminal interface for a process that you wish to spawn.

Would it be possible to embed a spawned process into a ScreenBuffer inside the current process's terminal?

Something like this: (pseudo-code)

let term = require("terminal-kit").terminal;
let instance = term.createScreenBuffer(width=80, height=40, x=0, y=10).connectToAProcessToSpawn("python server.py");

// Also some mechanism for taking control and detaching control from this instance
instance.focus(); // all terminal input is redirected to this process
instance.blur(); // all terminal input goes into the term object
cronvel commented 3 years ago

@davidcallanan This features does not exist yet. Already started working on it, but had not the time to finish it. Basically, it's a VTE backed by a ScreenBuffer, but it also need a TTY/PTY. Lot of work, I'm probably at 30% of completion.

davidcallanan commented 3 years ago

@cronvel That's good to know! It turns out for the time being I'm only going to need the stdout of a non-interactive process so I'm ok for now.