Working with Pipes

What we’ve built so far is already sufficient for a lot of automation tasks. For example, with our HTTP client from Chapter 3, Writing a Simple HTTP Client, and some JSON parsing, we could easily write a small, safe program that authenticates to an HTTP service and queries another endpoint for service discovery before launching another executable. An equivalent bash program could certainly be written, using tools like curl[25] and jq,[26] but such scripts rapidly grow in complexity and can be painful to maintain. However, there’s one more essential shell pattern we’ve yet to tackle: pipelines.

A pipeline is a series of cooperating processes executing simultaneously that communicate over in-memory channels called pipes

Get Modern Systems Programming with Scala Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.