An opportunity I use systemfd in combination with watchexec to run a web server project with a tight development loop. While I'm using Rust and Cargo for the examples in this post, this technique works for any compiled backend language. The compiled program can reuse the already opened listening socket so web clients see no disruption (the socket is never closed). systemfd will keep the listening socket open on the specified port while watchexec will recompile the server and run it on source file changes. While the compilation process is running, nothing is handling requests on the listening socket! We have three options: Do nothing, the browser will display a blank page during the whole compilation process. Wait until the compilation is successful before killing the previous web server version. Stream the compilation process to the web page. 👈 we're going with this one TLDR: Complete script Bash script The script has two parts, the systemfd/watchexec runner and the compile/run…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.