> > Ultimately, I may also insert some factor quot in betweeen > str1 and str2 to do some processing before handing the > result to cmd2.
Do you mean you want to take the output of running cmd1, manipulate it, then pass *that* to cmd2? Because that sounds rather different from what your example code looks like it's actually trying to do. It seems like your example is trying to construct launch descriptors independently, then pass those entire results to run-pipeline at once. Which is altogether easier: if I understand right, you're basically there already, but your main concern is more about how to build the array in a prettier way? If that's it, I suggest the `make` vocabulary: http://docs.factorcode.org/content/article-namespaces-make.html Some examples of `make` usage in the wild: https://github.com/slavapestov/factor/blob/master/basis/io/backend/unix/unix-tests.factor#L142-L147 https://github.com/slavapestov/factor/blob/master/basis/bootstrap/image/upload/upload.factor#L47-L51 https://github.com/slavapestov/factor/blob/master/extra/graphviz/render/render.factor#L62-L67 Granted, all of those are building a single process, not a pipeline. But the same principles apply: : cmd1 ( -- ) ... ; : cmd2 ( -- ) ... ; [ cmd1 , cmd2 , ] { } make run-pipeline On Mon, Sep 21, 2015 at 9:21 PM, HP Wei <hpwe...@gmail.com> wrote: > I want to run binary codes (C++) under linux using run-pipeline > > In linux shell, the task is > > cmd1 -a arg1 -b arg2 | cmd2 -c arg3 > > I know in general, in factor, I need to construct > > { str1 str2 } run-pipeline > where str1 = “cmd1 -a arg1 -b arg2” > str2 = “cmd2 -c arg3” > Ultimately, I may also insert some factor quot in betweeen > str1 and str2 to do some processing before handing the > result to cmd2. > > > Here is what I envision: > > TUPLE: cmd1 a b ; > > : <cmd1> ( — cmd1 ) > cmd1 new > “default a” >>a > “default b” >>b ; > > : get-cmd1 ( cmd1 — str1 ) > [ a>> ] [ b>> ] bi > “cmd1 -a %s -b %s” sprintf ; > > so now, I can write > > <cmd1> > my_b >>b > get-cmd1 > > ————— similarly for cmd2. > > But I bump into a mental block when trying to > put things together for run-pipeline > > If there were just one cmd1 (without cmd2), > I thought I could do > > ${ <cmd1> my_b >>b get-cmd1 } run-pipeline > > Adding cmd2, I could write > > ${ <cmd1> my_b >>b get-cmd1 <cmd2> my_c >>c get-cmd2 } run-pipeline > > But this looks ugly. > Is there a simpler way ? > > Thanks > HP Wei > > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk >
------------------------------------------------------------------------------
_______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk