bats icon indicating copy to clipboard operation
bats copied to clipboard

added example of piping commands together with run

Open inthecloud247 opened this issue 10 years ago • 6 comments

inthecloud247 avatar Mar 17 '14 21:03 inthecloud247

+1

rianwouters avatar Oct 10 '15 00:10 rianwouters

I had to tackle the same issue and I have resorted to the following:

run wc -l <(foo)

In my opinion, this way you have less problems with quoting

RomanSaveljev avatar Oct 10 '15 09:10 RomanSaveljev

In this particular case yes. But in general good to document how to run with pipes.

Verstuurd door Outlook voor Android

On Sat, Oct 10, 2015 at 2:35 AM -0700, "Roman Savelyev" [email protected] wrote: I had to tackle the same issue and I have resorted to the following:

run wc -l <(foo)

In my opinion, this way you have less problems with quoting


Reply to this email directly or view it on GitHub: https://github.com/sstephenson/bats/pull/47#issuecomment-147069207

rianwouters avatar Oct 10 '15 11:10 rianwouters

Thanks for opening this PR. It was helpful

jch avatar Dec 21 '15 05:12 jch

you're welcome :-) also see https://github.com/rianwouters/bexpect :-)

groetjes,

Rian

Date: Sun, 20 Dec 2015 21:05:05 -0800 From: [email protected] To: [email protected] CC: [email protected] Subject: Re: [bats] added example of piping commands together with run (#47)

Thanks for opening this PR. It was helpful

— Reply to this email directly or view it on GitHub.

rianwouters avatar Dec 21 '15 08:12 rianwouters

After reading through the original issue (https://github.com/sstephenson/bats/issues/10#issuecomment-26627687), I decided to avoid using run altogether. It just sets the special variables $output and $status, both of which are easily available. Here's an example: https://github.com/jch/jsg/blob/a960847b03c9de392f30b112d2c7ab2591608a6e/test/bin/jsg_markdown_test.sh#L4-L5

jch avatar Dec 21 '15 22:12 jch