Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

added example of piping commands together with run #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ an error message.
}
```

You may also find it useful to pipe commands together. To accomplish this with
the `run` helper, you will need to wrap the pipe in `bash -c` command:

```bash
@test "invoking foo displays 3 lines of output" {
run bash -c "foo | wc -l"
[ "$status" -eq 1 ]
[ "$output" -eq 3 ]
}
```

The `$status` variable contains the status code of the command, and
the `$output` variable contains the combined contents of the command's
standard output and standard error streams.
Expand Down