Gentoo Archives: gentoo-dev

From: Kent Fredric <kentfredric@×××××.com>
To: gentoo-dev@l.g.o
Cc: TomWij@g.o
Subject: Re: Can we have process names and stdout / stderr indication to more efficiently parse build logs? (was: Re: [gentoo-dev] rfc: escape sequences in logs)
Date: Wed, 04 Sep 2013 11:38:44
Message-Id: CAATnKFAFEMG4it7wDkDLs_cK9yudUQU_djZbmya1y01jjMTw-Q@mail.gmail.com
In Reply to: Re: Can we have process names and stdout / stderr indication to more efficiently parse build logs? (was: Re: [gentoo-dev] rfc: escape sequences in logs) by "Michał Górny"
1 On 4 September 2013 21:59, Michał Górny <mgorny@g.o> wrote:
2
3 > And how are you going to implement this? I doubt that fd/vt input has
4 > any sort of 'writing process id' indicator.
5 >
6
7 In one terminal:
8
9 cat -vET
10
11 In another:
12
13 pgrep -x cat # 199935
14
15
16 ls -la /proc/199935/fd/
17
18 dr-x------ 2 kent kent 0 Sep 4 23:29 .
19 dr-xr-xr-x 8 kent kent 0 Sep 4 23:28 ..
20 lrwx------ 1 kent kent 64 Sep 4 23:29 0 -> /dev/pts/3
21 lrwx------ 1 kent kent 64 Sep 4 23:29 1 -> /dev/pts/3
22 lrwx------ 1 kent kent 64 Sep 4 23:29 2 -> /dev/pts/3
23
24 So you can certainly get the information the ohter way round.
25
26
27 now...
28
29 Term 1:
30 $ tty
31 /dev/pts/3
32 $ cat -vET
33
34 Term 2:
35
36 for i in /proc/[0-9]*; do cmd=$(cat $i/comm); for j in $i/fd/*; do echo -n
37 "$cmd:$j:"; readlink $j ; echo ; done done | grep "pts/3"
38
39
40 bash:/proc/159261/fd/0:/dev/pts/3
41 bash:/proc/159261/fd/1:/dev/pts/3
42 bash:/proc/159261/fd/2:/dev/pts/3
43 bash:/proc/159261/fd/255:/dev/pts/3
44 gvim:/proc/175475/fd/0:/dev/pts/3
45 gvim:/proc/175475/fd/1:/dev/pts/3
46 gvim:/proc/175475/fd/2:/dev/pts/3
47 gvim:/proc/175642/fd/0:/dev/pts/3
48 gvim:/proc/175642/fd/1:/dev/pts/3
49 gvim:/proc/175642/fd/2:/dev/pts/3
50 gvim:/proc/199494/fd/0:/dev/pts/3
51 gvim:/proc/199494/fd/1:/dev/pts/3
52 gvim:/proc/199494/fd/2:/dev/pts/3
53 cat:/proc/207567/fd/0:/dev/pts/3
54 cat:/proc/207567/fd/1:/dev/pts/3
55 cat:/proc/207567/fd/2:/dev/pts/3
56
57 I see. I have a few gvim instances also reading/writing to that terminal I
58 didn't know about, interesting.
59
60
61
62 --
63 Kent

Replies