Rambo: Run your command. Send EOF. Get output

After wrestling with ports for the nth time, I wrote Rambo to easily get output from external programs.

The idea to use a shim is far from original, but previous libraries were either too heavyweight or complicated (comparisons here). Rambo is intentionally kept simple and lightweight, the shim is written in Rust.


Rambo

Rambo has one mission. Start your program, pipe standard input, send EOF and return with output.

Rambo.run("cat", in: "hello")
{:ok, %Rambo{out: "hello"}}

Rambo.run("echo", ["-n", "world"])
{:ok, %Rambo{out: "world"}}

Rambo.run("ls") |> Rambo.run("sort") |> Rambo.run("head")
{:ok, %Rambo{out: "bar\nbaz\nfoo\n"}}

HexDocsGitHub

8 Likes

How is this different from Porcelain?

Answered in the README:

2 Likes

Oh nice! From the readme:

Porcelain

To make Porcelain useful, you must install its shim Goon separately. Rambo ships with the required native binaries.

Goon is written in Go, a multi-threaded runtime with a garbage collector. To be as lightweight as possible, Rambo’s shim is written in Rust. Single threaded, no garbage collector, no runtime overhead.

@AndyL Glad you found it, but the most important reason was obscured by my poor attempt at whimsy. I’ve updated the Porcelain section with

Most importantly, Goon currently leaks processes. This isn’t an intractable problem, in fact writing a new driver to replace Goon should fix it. But Porcelain appears to be abandoned and I need this in production so effort went into creating Rambo.

2 Likes