From 51527612d3162fde31c41d7183320365856f2aae Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Tue, 30 Sep 2014 17:06:56 -0700 Subject: Don't leave is_block in bad state after bad redirection Fixes #1728. --- tests/gen_output.fish | 4 ++-- tests/status.err | 2 ++ tests/status.in | 9 +++++++++ tests/status.out | 0 tests/status.status | 1 + tests/top.out | 1 + 6 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/status.err create mode 100644 tests/status.in create mode 100644 tests/status.out create mode 100644 tests/status.status (limited to 'tests') diff --git a/tests/gen_output.fish b/tests/gen_output.fish index 49e15bfd..7bf7f3ec 100755 --- a/tests/gen_output.fish +++ b/tests/gen_output.fish @@ -1,4 +1,4 @@ -#!/usr/bin/fish +#!/usr/bin/env fish # # Generate output for a test script @@ -14,4 +14,4 @@ for i in $argv fish <$i >$template_out ^$template_err echo $status >$template_status -end \ No newline at end of file +end diff --git a/tests/status.err b/tests/status.err new file mode 100644 index 00000000..91645c95 --- /dev/null +++ b/tests/status.err @@ -0,0 +1,2 @@ +fish: An error occurred while redirecting file '/' +open: Is a directory diff --git a/tests/status.in b/tests/status.in new file mode 100644 index 00000000..14dff232 --- /dev/null +++ b/tests/status.in @@ -0,0 +1,9 @@ +# vim: set filetype=fish: + +# Issue #1728 +# Bad file redirection on a block causes `status --is-block` to return 0 forever. +begin; end >/ # / is a directory, it can't be opened for writing +status -b +and echo 'block' + +true diff --git a/tests/status.out b/tests/status.out new file mode 100644 index 00000000..e69de29b diff --git a/tests/status.status b/tests/status.status new file mode 100644 index 00000000..573541ac --- /dev/null +++ b/tests/status.status @@ -0,0 +1 @@ +0 diff --git a/tests/top.out b/tests/top.out index a62ec047..87d1ee31 100644 --- a/tests/top.out +++ b/tests/top.out @@ -2,6 +2,7 @@ Testing high level script functionality File expansion.in tested ok File printf.in tested ok File read.in tested ok +File status.in tested ok File test1.in tested ok File test2.in tested ok File test3.in tested ok -- cgit v1.2.3