[comp.unix.questions] 'peeking' in on a pipe

Tim.Evans@f112.n138.z1.WA.COM (Tim Evans) (07/04/89)

I would like to 'peek' in on a pipe, to see what is happening in it, WHILE
IT EXECUTES. I tried something like this, but no luck:
 
  some_stuff | tee `tty` | more_stuff
 
I would like to do this while it executes, not tee to a file and see it
later. Does anyone have any ideas how this might be done?
Thanks,
...Tim


--  
///////////////////////////////////////////////////////////////////
 - BBS phone no. +1 (206) 822-4615  FidoNet 1:343/15 Kirkland,WA USA
 - UUCP       uunet!nwnevus!seaeast 
              uw-beaver!thebes!camco!happym!rwing!seaeast
 - INTERNET   seaeast.WA.COM            
///////////////////////////////////////////////////////////////////

maart@cs.vu.nl (Maarten Litmaath) (07/08/89)

Tim.Evans@f112.n138.z1.WA.COM (Tim Evans) writes:
\I would like to 'peek' in on a pipe, to see what is happening in it, WHILE
\IT EXECUTES. I tried something like this, but no luck:
\ 
\  some_stuff | tee `tty` | more_stuff
\ 
\I would like to do this while it executes, not tee to a file and see it
\later. Does anyone have any ideas how this might be done?

This is funny!
Did you ever ls(1) your directory after issuing the pipeline command above?
I bet you'd find three files you didn't expect:

	a
	not
	tty

stdin of the `tty` command is a pipe, hence the message "not a tty", so
tee(1) sees 3 `filenames' to duplicate stdout to!
Solution:

	foobie | tee /dev/tty | bletch
-- 
   "... a lap-top Cray-2 with builtin    |Maarten Litmaath @ VU Amsterdam:
cold fusion power supply"  (Colin Dente) |maart@cs.vu.nl, mcvax!botter!maart

mvp@v7fs1.UUCP (Mike Van Pelt) (07/11/89)

>Tim.Evans@f112.n138.z1.WA.COM (Tim Evans) writes:
>I would like to 'peek' in on a pipe, to see what is happening in it, WHILE
>IT EXECUTES. I tried something like this, but no luck:
> 
>  some_stuff | tee `tty` | more_stuff

Here's what I do -- I'm assuming you want to just peek in on it
from time to time, not look at the whole thing.

some_stuff | tee bletch | more stuff

Then, if I want to check in on what's going through the tee
I just tail bletch,  or, if I want to monitor it for a while,
tail -f bletch.

-- 
Mike Van Pelt                     "I'm not a biologist, but I play one in 
Headland Technology/Video 7        front of Congressional hearings."
...ames!vsi1!v7fs1!mvp                        -- Meryl Streep

rey@safn2.UUCP (Reynolds McClatchey) (07/12/89)

In article <6.24B47361@seaeast.WA.COM>, Tim.Evans@f112.n138.z1.WA.COM (Tim Evans) writes:
> I would like to 'peek' in on a pipe, to see what is happening in it, WHILE
> IT EXECUTES. I tried something like this, but no luck:
>  
>   some_stuff | tee `tty` | more_stuff

See Unix World Sept 87 for branch & combine C source by Brian Keen.
They enable you to pump into or tap out of a pipe. I've found them useful.

Reynolds McClatchey   uunet!safn2!rey

mcs@atux01.UUCP (M. Sabanos) (07/12/89)

In article <6.24B47361@seaeast.WA.COM>, Tim.Evans@f112.n138.z1.WA.COM (Tim Evans) writes:
> I would like to 'peek' in on a pipe, to see what is happening in it, WHILE
> IT EXECUTES. I tried something like this, but no luck:
>  
>   some_stuff | tee `tty` | more_stuff
>  
> I would like to do this while it executes, not tee to a file and see it
> later. Does anyone have any ideas how this might be done?

Try this instead:

   some_stuff | tee /dev/tty | more_stuff


> Thanks,
> ...Tim

Your welcome,

  Mike Sabanos 

mre@beatnix.UUCP (Mike Eisler) (07/14/89)

In article <6.24B47361@seaeast.WA.COM>, Tim.Evans@f112.n138.z1.WA.COM (Tim Evans) writes:
> I would like to 'peek' in on a pipe, to see what is happening in it, WHILE
> IT EXECUTES. I tried something like this, but no luck:
>  
>   some_stuff | tee `tty` | more_stuff

Try
	 some_stuff | tee /dev/tty | more_stuff

 ... | tee `tty` | more_stuff fails because tty(1) calls ttyname(3) to find

terminal name with file descriptor 0 as its argument. Fd 0 is a pipe
when tee is used inside a pipeline.
	uunet!elxsi!mre