• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reading a file as it fills up by another program
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading a file as it fills up by another program


  • Subject: Re: Reading a file as it fills up by another program
  • From: Harald E Brandt <email@hidden>
  • Date: Fri, 12 Dec 2003 15:04:30 +0100

+--> Christopher Stone wrote 03-12-12:
At 16:47 +0100 12/11/2003, Harald E Brandt wrought:

How to read a file, record by record, as the file is being filled up by another process?
...
If using 'open for access', EOF will retain its value of 0 until the file is closed, so it won't read the file as it fills up. Is it possible at all to use the standard 'read' to do that?
______________________________________________________________________

Hello Harald,

Hmm. There is never any need to open a file if you just want to read it.

Does your Unix process keep the file open? Or does it close it after it writes to it?
+-

It keeps the file open - it is a redirect (incl stderr) after a pipe. I just talked to a Unix guru who sais that this is a relatively common problem caused by the fact that Unix usually buffers everything before it is actually written to file. That means I am stuck!

TN 2065 (http://developer.apple.com/technotes/tn2002/tn2065.html) states (concerning "How do I read the results as they come in?"): "What you can do, however, is to put the command into the background (see the next question), send its output to a file, and then read the file as it fills up".

So that's what I am doing! But if the thing gets buffered, no tool whatsoever will be able to read the file because the file is actually not written to until the whole thing is over!! The size of the file is only about 2 kB, but it may take anything from a few seconds to a few minutes to fill it up. I just checked by simply doing 'ls -l' repeatadly, and indeed, the file has zero length until the original process (a curl download) terminates!

I really wonder if Chris himself has tried the suggestion in TN 2065?.


Is it really *impossible* to get those progress reports from curl and similar programs into AppleScript Studio so I can show them in the GUI (without waiting for the whole thing to terminate)?

Hoping for the gurus to answer...

--heb
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Reading a file as it fills up by another program
      • From: Christopher Nebel <email@hidden>
    • Re: Reading a file as it fills up by another program
      • From: Walter Ian Kaye <email@hidden>
References: 
 >Reading a file as it fills up by another program (From: Harald E Brandt <email@hidden>)
 >Re: Reading a file as it fills up by another program (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Type and Creator while being copied or created
  • Next by Date: Re: Aqua keys
  • Previous by thread: Re: Reading a file as it fills up by another program
  • Next by thread: Re: Reading a file as it fills up by another program
  • Index(es):
    • Date
    • Thread