feather icon indicating copy to clipboard operation
feather copied to clipboard

Easier piping of string to stdin?

Open arvidj opened this issue 6 months ago • 1 comments

IIUC, the way to write something to a process's stdin is Process.(echo "foobar" |. proc "sha256sum" [] |> collect stdout). The echo will create a process invoking the echo binary -- this seems a bit wasteful. Is there some way of writing a string directly to the standard input of a process? Something like (<<<) : proc -> string -> proc, analogous to the bash here-strings ? Such that the above could be written `Process.(proc "sha256sum" [] <<< "foobar" |> collect stdout_.

arvidj avatar Jun 23 '25 15:06 arvidj

That's a great idea! I'll definitely land a PR adding that sort of thing :)

charlesetc avatar Jun 27 '25 15:06 charlesetc