Skip to content

Commands become a DAG: split and join #21

@charlesetc

Description

@charlesetc

Right now, our commands construct a linear chain of pipes. It would be nice if we could do arbitrary DAGs, something along the lines of:

val split : cmd -> cmd * cmd
(** [split] a command into two identical commands that have the same output *)

val as_fifo : cmd -> string
(** take a command and turn it into a named pipe. Similar to <( ... ) in bash. *)

This could be used like so:

let log1, log2 = process "tail" [ "-f" ; "log" ] |> split in 
process "cat" [as_fifo (log1 |. shuf); as_fifo (log2 |. sort)] |> run

The named pipes would have to be cleaned up when the Feather.run exits and Stdlib.at_exit.

I looked into this a bit and the most annoying part is that neither Base nor Stdlib implement a way to get the name of a tempfile without actually creating the tempfile. (We want to mkfifo ourselves.) So we'll have to implement our own random tempfile function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions