summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcmdtest7
1 files changed, 6 insertions, 1 deletions
diff --git a/cmdtest b/cmdtest
index e84602b..fc362ef 100755
--- a/cmdtest
+++ b/cmdtest
@@ -137,16 +137,21 @@ class CommandTester(cliapp.Application):
if test.args:
argv.extend(self.expand(self.lines(test.args)))
- stdin = self.cat(test.stdin or '/dev/null')
stdout_name = test.path_prefix + '.stdout-actual'
stderr_name = test.path_prefix + '.stderr-actual'
with open(stdout_name, 'wb') as stdout:
with open(stderr_name, 'wb') as stderr:
+ if test.stdin:
+ stdin = open(test.stdin, 'rb')
+ else:
+ stdin = None
exit, out, err = self.runcmd_unchecked(argv,
env=self.add_to_env(),
stdin=stdin,
stdout=stdout,
stderr=stderr)
+ if stdin is not None:
+ stdin.close()
errors = []