From: nirva@ishiboo.com (Danny Dulai)
To: zsh-users@sunsite.auc.dk
Subject: Re: tostop && TTOU
Date: 12 Dec 1999 23:34:28 -0000 [thread overview]
Message-ID: <Liam.945041667.991815.21376.1285660638@fizz> (raw)
In-Reply-To: <991212225840.ZM9656@candle.brasslantern.com>
On 12/12/99, Bart Schaefer said:
>On Dec 12, 11:22am, Danny Dulai wrote:
>} Subject: tostop && TTOU
>}
>} I'm trying to get TTOU generated in a script, without forcing the user to
>} stty tostop in the terminal controling shell.
>
>You're going to have to give a few more details about the script.
>
>In order to get a TTOU, the script itself must run in the background, or
>it starts a background job; which one is it?
>
>I played with this a bit, and if I run a script in the background which
>attempts to do anything with stty, it gets TTOU even when the original
>stty settings include -tostop. I can only change the settings with a
>foreground job.
(~) % cat p
stty tostop
function o() {
# so blank function doesnt complain
foo=bar
}
trap o TTOU
helu=0
while :; do
sleep 1
echo $helu
helu=$(($helu+1))
done
return 0
(~) % stty
speed 9600 baud; line = 0;
erase = ^H;
-brkint -imaxbel
tostop
(~) % /usr/local/src/zsh-3.1.5/Src/zsh p
0
1
zsh: 6096 suspended /usr/local/src/zsh-3.1.5/Src/zsh p
(~) % bg
[1] + continued /usr/local/src/zsh-3.1.5/Src/zsh p
(~) % fg <--- after waiting a few seconds
[1] + running /usr/local/src/zsh-3.1.5/Src/zsh p
6
7
8
Ok, thats the desired behavior. The write() to stdout stops happening becuase
the SIGTTOU interrupts it i assume. But:
(~) % stty -tostop
(~) % /usr/local/src/zsh-3.1.5/Src/zsh p
0
1
zsh: 6112 suspended /usr/local/src/zsh-3.1.5/Src/zsh p
(~) % bg
[1] + continued /usr/local/src/zsh-3.1.5/Src/zsh p
(~) % 2
3
4
5
6
The stty tostop in the begining of the script seems to have done nothing :(
This is all using zsh 3.1.6-pws-11.
What I'm trying to do is find out if the script is running in the background or
in the foreground. Another solution (other than TTOU) is to use TTIN, but I
can't figure out a way to do a nonblocking read from stdin from within a zsh
script. The TTIN solution is pretty easy if that read functionality exists,
because you dont have to mess with tty settings to get a TTIN.
--
___________________________________________________________________________
Danny Dulai Feet. Pumice. Lotion.
http://www.ishiboo.com/~nirva/ nirva@ishiboo.com
prev parent reply other threads:[~1999-12-12 23:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-12-12 11:22 Danny Dulai
1999-12-12 22:58 ` Bart Schaefer
1999-12-12 23:34 ` Danny Dulai [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Liam.945041667.991815.21376.1285660638@fizz \
--to=nirva@ishiboo.com \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).