From 8bf0f0cf45606971d1433b36ce21ab45f6226004 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 18 Jan 2022 23:20:53 +0100 Subject: 49694 + doc: Allow using empty STTY= to freeze tty for a single command Previously, doing this would just run stty with no arguments, which normally causes it to print some terminal settings to stdout. --- Src/exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Src/exec.c') diff --git a/Src/exec.c b/Src/exec.c index 1860a10ed..f67074846 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -684,8 +684,10 @@ execute(LinkList args, int flags, int defpath) /* If the parameter STTY is set in the command's environment, * * we first run the stty command with the value of this * - * parameter as it arguments. */ - if ((s = STTYval) && isatty(0) && (GETPGRP() == getpid())) { + * parameter as it arguments. If the parameter is empty, we * + * do nothing, but this causes the terminal settings to be * + * restored later which can be useful. */ + if ((s = STTYval) && *s && isatty(0) && (GETPGRP() == getpid())) { char *t = tricat("stty", " ", s); STTYval = 0; /* this prevents infinite recursion */ -- cgit 1.4.1