diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash_test/ash-misc/piped_input.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-misc/piped_input.tests | 3 | ||||
-rw-r--r-- | shell/hush.c | 6 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/piped_input.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/piped_input.tests | 3 |
5 files changed, 15 insertions, 1 deletions
diff --git a/shell/ash_test/ash-misc/piped_input.right b/shell/ash_test/ash-misc/piped_input.right new file mode 100644 index 000000000..7b8bf6758 --- /dev/null +++ b/shell/ash_test/ash-misc/piped_input.right | |||
@@ -0,0 +1,2 @@ | |||
1 | TEST | ||
2 | One:1 | ||
diff --git a/shell/ash_test/ash-misc/piped_input.tests b/shell/ash_test/ash-misc/piped_input.tests new file mode 100755 index 000000000..ec7e49837 --- /dev/null +++ b/shell/ash_test/ash-misc/piped_input.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | exed 2>&1 | ||
2 | echo 'echo TEST; false' | $THIS_SH | ||
3 | echo One:$? | ||
diff --git a/shell/hush.c b/shell/hush.c index 3bdbe26d8..f9a295e8d 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -7787,7 +7787,11 @@ static void restore_redirects(struct squirrel *sq) | |||
7787 | free(sq); | 7787 | free(sq); |
7788 | } | 7788 | } |
7789 | if (G.HFILE_stdin | 7789 | if (G.HFILE_stdin |
7790 | && G.HFILE_stdin->fd != STDIN_FILENO | 7790 | && G.HFILE_stdin->fd > STDIN_FILENO |
7791 | /* we compare > STDIN, not == STDIN, since hfgetc() | ||
7792 | * closes fd and sets ->fd to -1 if EOF is reached. | ||
7793 | * Testcase: echo 'pwd' | hush | ||
7794 | */ | ||
7791 | ) { | 7795 | ) { |
7792 | /* Testcase: interactive "read r <FILE; echo $r; read r; echo $r". | 7796 | /* Testcase: interactive "read r <FILE; echo $r; read r; echo $r". |
7793 | * Redirect moves ->fd to e.g. 10, | 7797 | * Redirect moves ->fd to e.g. 10, |
diff --git a/shell/hush_test/hush-misc/piped_input.right b/shell/hush_test/hush-misc/piped_input.right new file mode 100644 index 000000000..7b8bf6758 --- /dev/null +++ b/shell/hush_test/hush-misc/piped_input.right | |||
@@ -0,0 +1,2 @@ | |||
1 | TEST | ||
2 | One:1 | ||
diff --git a/shell/hush_test/hush-misc/piped_input.tests b/shell/hush_test/hush-misc/piped_input.tests new file mode 100755 index 000000000..ec7e49837 --- /dev/null +++ b/shell/hush_test/hush-misc/piped_input.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | exed 2>&1 | ||
2 | echo 'echo TEST; false' | $THIS_SH | ||
3 | echo One:$? | ||