[[ peter cc'd cause he seemed to add the original
"exec a non-shell option" to script(1) ]]
Hello all,
I noticed that when running "script" and passing a program
to exec that ^Z does not seem to work (although ^C does).
I'm trying to figure a workaround and what I was going to
do was add ISIG to the term flags when spawning a non-shell
utility.
(should I also check /etc/shells to help preserve POLA
further?)
Any pointers on this?
Would this be a good idea, or a bad idea? Terminal gurus
give me a hand please! :)
please ignore the sigflg part at the top for now, prepping
for possible cli option to avoid POLA breakage.
Is there a way to detect ^Z or other terminal signals and propogate
them to the child in a better way?
--
- Alfred Perlstein
.- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250
.- FreeBSD committer
Index: script.c
===================================================================
--- script.c (revision 195826)
+++ script.c (working copy)
@@ -68,6 +68,7 @@
int child;
const char *fname;
int qflg, ttyflg;
+int sigflg;
struct termios tt;
@@ -104,6 +105,9 @@
case 'k':
kflg = 1;
break;
+ case 'S':
+ sigflg = 1;
+ break;
case 't':
flushtime = atoi(optarg);
if (flushtime < 0)
@@ -241,11 +245,20 @@
doshell(char **av)
{
const char *shell;
+ struct termios rtt;
shell = getenv("SHELL");
if (shell == NULL)
shell = _PATH_BSHELL;
+ if (av[0]) {
+ /* enable signals for non-shell programs */
+ rtt = tt;
+ cfmakeraw(&rtt);
+ rtt.c_lflag &= ~ECHO;
+ rtt.c_lflag |= ISIG;
+ (void)tcsetattr(STDIN_FILENO, TCSAFLUSH, &rtt);
+ }
(void)close(master);
(void)fclose(fscript);
login_tty(slave);
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[email protected]"