let concat ~(run_with : Machine.t) bunch_of_dot_gzs ~result_path =
let open KEDSL in
let program =
Program.(
exec ["mkdir"; "-p"; Filename.dirname result_path]
&& shf "gunzip -c %s > %s"
(List.map bunch_of_dot_gzs
~f:(fun o -> Filename.quote o#product#path)
|> String.concat ~sep:" ") result_path
) in
let name =
sprintf "gunzipcat-%s" (Filename.basename result_path) in
workflow_node
(single_file result_path ~host:Machine.(as_host run_with))
~name
~make:(Machine.run_stream_processor ~name run_with program)
~edges:(
on_failure_activate Remove.(file ~run_with result_path)
:: List.map ~f:depends_on bunch_of_dot_gzs)