develooper Front page | perl.perl6.users | Postings from June 2018

Re: using run

Thread Previous | Thread Next
Theo van den Heuvel
June 20, 2018 15:56
Re: using run
Message ID:
thanks. That helps

Jonathan Scott Duff schreef op 2018-06-20 17:50:
> 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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About