If you don't specify the :out adverb, then the output of the program you are running will be sent to standard output. Immediately when the program executes. If you specify the :out adverb, output from the program will be available for capture via the $proc.out method. A similar thing applies for standard error.
A way to write the captured output to a file would be something like: my $proc = run 'echo', 'foo bar baz', :out; spurt("some-file-name", $proc.out.slurp(:close)); .slurp() will read all of the contents of the handle and return a string (:close closes the file handle after reading everything). spurt will write a string to a file. hope this helps, -Scott On Wed, Jun 20, 2018 at 10:33 AM Theo van den Heuvel <vdheu...@heuvelhlt.nl> wrote: > Hi all, > > trying to make sense of the documentation on run: > https://docs.perl6.org/routine/run. > In particular the last part. I don't understand the adverbs :out and : > err there. > Can I set it up so that the output is piped into a file directly? If so > how would I write that? > > I know I could use shell for that, but I doubt that is necessary. > > [On first reading I found the doc confusing because it start with a > hairy example. WHy would anyone wish to write to a file named > '>foo.txt'? How can that be the first example?] > > Thanks, > > -- > Theo van den Heuvel >