Gentoo Archives: gentoo-portage-dev

From: Jason Stubbs <jstubbs@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
Date: Wed, 20 Jul 2005 23:39:39
Message-Id: 200507210839.18888.jstubbs@gentoo.org
In Reply to: Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527) by Drake Wyrm
1 On Thursday 21 July 2005 01:32, Drake Wyrm wrote:
2 > Jason Stubbs <jstubbs@g.o> wrote:
3 > > On Wednesday 20 July 2005 15:38, Drake Wyrm wrote:
4 > > > Jason Stubbs <jstubbs@g.o> wrote:
5 > > > > When logging is enabled, ebuild output is passed via tee. Running
6 > > > > anything that checks for terminal type inside of pkg_config
7 > > > > therefore doesn't work correctly. This patch disables logging
8 > > > > during pkg_config altogether.
9 > > >
10 > > > A cleaner way of accomplishing that is to write the ebuild such that
11 > > > portions which need a terminal either attach to a terminal (`make
12 > > > menuconfig </dev/tty >/dev/tty`)
13 > >
14 > > Forgive my ignorance, but how does this work when it comes to
15 > > multiuser?
16 >
17 > You mean when there's multiple terminals in use? The device "/dev/tty"
18 > has more magic. No matter what terminal you're using, even if stdin,
19 > stdout, and stderr have been closed or redirected, "/dev/tty" is
20 > _always_ your current terminal.
21 >
22 > { echo foo >/dev/tty ; } </dev/null &>/dev/null
23 >
24 > Still gets through! Or even more detached:
25 >
26 > ( ( sleep 2 ; echo foo >/dev/tty ) & disown ) </dev/null &>/dev/null
27 >
28 > The only way this can fail is if the terminal actually closes.
29 >
30 > ( ( sleep 2 ; echo foo >/dev/tty || touch /tmp/wombat ) & \
31 > disown ) </dev/null &>/dev/null ; exit
32 >
33 > Other apps use this, also. You may have noticed that when you drop to
34 > shell from `less` and type `tty`, you're no longer attached to
35 > /dev/pts/* or /dev/vc/*, but simply to /dev/tty. Do the same thing in
36 > multiple xterms, and you'll find yourself with several terminals all
37 > attached to unique instances of /dev/tty which have nothing to do with
38 > each other. More magic.
39
40 That works for me then. :)
41
42 --
43 Jason Stubbs