Acquire tty if interactive when running builtins

When running a builtin, if we are an interactive shell and stdin is a tty,
then acquire ownership of the terminal via tcgetpgrp() before running the
builtin, and set it back after.

Fixes #4540
This commit is contained in:
ridiculousfish
2018-08-04 17:32:04 -07:00
parent c0a332743f
commit fa66ac8d8c
4 changed files with 32 additions and 1 deletions

View File

@@ -90,6 +90,14 @@ expect_prompt
expect_marker 7
print_var_contents foo
# Verify we don't hang on `read | cat`. See #4540.
send_line "read | cat"
expect_read_prompt
send_line -h "bar\r_marker 4540"
expect_prompt
expect_marker 4540
# ==========
# The fix for issue #2007 initially introduced a problem when using a function
# to read from /dev/stdin when that is associated with the tty. These tests