diff options
Diffstat (limited to 'src/opt')
| -rw-r--r-- | src/opt/vyatta/share/vyatta-op/functions/interpreter/vyatta-op-run | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/opt/vyatta/share/vyatta-op/functions/interpreter/vyatta-op-run b/src/opt/vyatta/share/vyatta-op/functions/interpreter/vyatta-op-run index 53b94ad98..1f233710b 100644 --- a/src/opt/vyatta/share/vyatta-op/functions/interpreter/vyatta-op-run +++ b/src/opt/vyatta/share/vyatta-op/functions/interpreter/vyatta-op-run @@ -169,9 +169,18 @@ _vyatta_op_run () _vyatta_op_last_comp=${_vyatta_op_last_comp_init} false; estat=$? - stty echo 2> /dev/null # turn echo on, this is a workaround for bug 7570 - # not a fix we need to look at why the readline library - # is getting confused on paged help text. + + # Only touch terminal settings when `stdout` is a real TTY. + # When output is piped (e.g. via `sudo ... | cat`), running `stty` can interfere + # with non-interactive execution and produce corrupted/indented output. + if [ -t 1 ]; then + + # Turn echo on, this is a workaround for bug 7570 + # not a fix we need to look at why the readline library + # is getting confused on paged help text. + stty echo 2> /dev/null + + fi i=1 declare -a args # array of expanded arguments |
