Piping Compilation Logs to the Browser using systemfd

Hey folks, I wanted to share a fun hack I put together to fix a daily annoyance.

When developing a compiled backend (Rust in my case), waiting for the server to rebuild usually means staring at a hanging browser tab or a "Connection Refused" error if you refresh too early.

To fix this, I set up a dev loop using systemfd to hold the listening socket open between restarts. While the compiler is running, I use socat to hijack that socket and stream the raw terminal build logs directly to the browser via HTTP/1.1 stream response and xterm.js.

Once the build succeeds, the page smoothly transitions to the actual web app.

It's language-agnostic and completely gets rid of the blank page downtime. I'd love to hear what you think or if anyone else has built a similar dev loop!

submitted by /u/izissise
[link] [comments]