From: Paul Haas <paulh@hamjudo.com>
To: cygwin@cygwin.com
Subject: Re: tail and win file handling
Date: Wed, 19 May 2004 17:42:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.44.0405191052310.13862-100000@bacon.hamjudo.com> (raw)
Larry Hall wrote:
> the file deleted by "rm" isn't deleted really until it's closed, which
> won't happen until 'tail' ends. This is the way Windows works. There's
> not much to be done about it (at least not in Cygwin). Believe me,
> we've tried.
Here is a really ugly kludge to deal with a really ugly file system.
I'm sure I read about this sort of kludge before, so the idea is certainly
not original.
-------Cut here------
#!/usr/bin/perl -w
# this acts sort of like tail -f, but doesn't keep the
# open. It is designed for non-unix systems where open files
# can't be deleted.
# It mindlessly shows the last 512 bytes of the file on startup
# rather than the last 10 lines.
#
# Paul Haas, May 19, 2004
my $file = shift;
open(TF,$file) || die "Reading $file $!";
seek(TF,-512,2);
@lines=<TF>;
my $curpos=tell(TF);
close(TF);
print @lines;
sleep 1;
while(-r $file ) {
open(TF,$file) || die "Rereading $file $!";
seek(TF,$curpos,0);
@lines=<TF>;
$curpos = tell(TF);
print @lines;
close(TF);
sleep 1;
}
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
next reply other threads:[~2004-05-19 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-19 17:42 Paul Haas [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-05-18 13:31 binutils 20040312-1 : problem linking 16bit x86 code with ld Corinna Vinschen
2004-05-18 13:36 ` tail and win file handling C Wells
2004-05-18 16:58 ` Larry Hall
2004-05-18 17:23 ` C Wells
2004-05-18 22:13 ` Larry Hall
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=Pine.LNX.4.44.0405191052310.13862-100000@bacon.hamjudo.com \
--to=paulh@hamjudo.com \
--cc=cygwin@cygwin.com \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).