aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--exec.cpp6
-rwxr-xr-xtests/gen_output.fish4
-rw-r--r--tests/status.err2
-rw-r--r--tests/status.in9
-rw-r--r--tests/status.out0
-rw-r--r--tests/status.status1
-rw-r--r--tests/top.out1
7 files changed, 18 insertions, 5 deletions
diff --git a/exec.cpp b/exec.cpp
index 60b46ab9..e282f72f 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -516,9 +516,6 @@ static void internal_exec_helper(parser_t &parser,
std::vector<int> opened_fds;
bool transmorgrified = io_transmogrify(ios, &morphed_chain, &opened_fds);
- int is_block_old=is_block;
- is_block=1;
-
/*
Did the transmogrification fail - if so, set error status and return
*/
@@ -528,6 +525,9 @@ static void internal_exec_helper(parser_t &parser,
return;
}
+ int is_block_old=is_block;
+ is_block=1;
+
signal_unblock();
if (node_offset == NODE_OFFSET_INVALID)
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
--- /dev/null
+++ b/tests/status.out
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