Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!convex!news From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.questions Subject: Re: re-directing 'rup' to a file Message-ID: <1991Mar05.080251.15424@convex.com> Date: 5 Mar 91 08:02:51 GMT References: <1991Mar5.014821.1555@unixland.uucp> Sender: news@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 30 Nntp-Posting-Host: pixel.convex.com From the keyboard of bill@unixland.uucp (Bill Heiser): :I have a user that wants to get a list of hosts on the network :that respond with n seconds. I have a "timeout" program that someone :on the net sent me -- it times out if a command doesn't complete :within a certain number of seconds -- and aborts the command. [possibly mine -- i've one that looks like that i've sent out] :Anyway, he is trying to do something like : timeout 10 rup > rup.list : :When the timeout occurs, though, there is nothing in rup.list! : :The same thing happens if I type 'rup > rup.lis' and control-c :out of it after some time period. : :Is it something to do with buffering of output? Yes, that's exactly it. Stdio is disk buffering. :How can I make whatever output occurs within seconds go to the file? You need to get it to think its output is a tty. Dan will suggest using pty. Nothing much short of hacking the source comes to mind. While it's nice that pty should care of a lot of obnoxious things like this, I think that this is just a hack around a problem caused by lack of design forethought in stdio: you shouldn't need a whole pty just to get line buffering! --tom