Hacker News new | ask | show | jobs
by krat0sprakhar 3956 days ago
I can't read much of Go so can anyone explain how does this work at a high-level? The Vim editing example looks really cool! Does it keep taking a snapshot of the running command and send the data via a websocket?
2 comments

https://github.com/yudai/gotty/blob/master/app/app.go#L73-L1...

^ Those are the key lines really.

It's running the command in a pseudo-terminal, capturing the output (as text) and sending it over a web socket.

I doubt it takes snapshots, I suspect it just runs the program with a redirected and buffered stdin, stdout, and stderr.