Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Read arguments from a script instead of stdin #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

krallin
Copy link

@krallin krallin commented Jan 17, 2022

If a program under test reads stdin (e.g. by accident), then cram's
current behavior can be a little confusing, since what will happen is
that it'll omit running anything because the script has been read.

For example, if your test file is

  $ echo 123
  123
  $ cat > /dev/null
  $ echo 456
  456
  $ echo 789
  789

Then running it yields:

   $ echo 123
   123
   $ cat > /dev/null
   $ echo 456
-  456
-  $ echo 789
-  789

This patch updates cram to pass the script via file instead, which makes
this mistake harder to make. I've also updated one of the tests that was
implicitly relying on this (debug.t).

If a program under test reads stdin (e.g. by accident), then cram's
current behavior can be a little confusing, since what will happen is
that it'll omit running anything because the script has been read.

For example, if your test file is

```
  $ echo 123
  123
  $ cat > /dev/null
  $ echo 456
  456
  $ echo 789
  789
```

Then running it yields:

```
   $ echo 123
   123
   $ cat > /dev/null
   $ echo 456
-  456
-  $ echo 789
-  789
```

This patch updates cram to pass the script via file instead, which makes
this mistake harder to make. I've also updated one of the tests that was
implicitly relying on this.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant