4 ms·
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 t
by krat0sprakhar 11y 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?
- scott_karana 11y agoI doubt it takes snapshots, I suspect it just runs the program with a redirected and buffered stdin, stdout, and stderr.
- JamesMcMinn 11y agohttps://github.com/yudai/gotty/blob/master/app/app.go#L73-L103 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.