cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: reading a log file while open

From: Jeremy Nicoll <jn.ml.crlu.36_at_letterboxes.org>
Date: Fri, 22 Apr 2016 10:04:57 +0100

On Fri, 22 Apr 2016, at 07:17, Daniel Stenberg wrote:
> On Fri, 22 Apr 2016, Francisco Gonzalez Velasco wrote:
>
> > C:\>curl -o c:\q\events.txt -k -H "Authorization: Bearer My_Authorization" "
> > https://stream-fxpractice.oanda.com/v1/events"
> >
> > I need to read the contents of the events.txt file while the cURL process is
> > still active.
> >
> > Is this possible?
>
> That's not curl making it hard, that's Windows for you. Any other
> operating system would let you read the file while another process
> is writing to it...

Some might, but for example z/OS would not. A process there would
normally have
exclusive access to a file while it was being written. If the 'file'
were part of a database
then the program would have exclusive access to the record that it was
updating.

Under Windows it depends on two things - the way the program (curl in
this case) opens
the file to write to it, and the way the program that wants to read that
file tries to do so.

For example, although the linux/unix 'tail' utility is not part of
Windows, but there are ports
available. If I want to use a tail utility under Windows, to read
logging files created by the
scripts I've written that run under Windows, those scripts need to open
the logs files using
(in ooREXX) a statement like:

  openit = stream(logfile,"COMMAND","OPEN WRITE APPEND SHARED")

so I'd suggest that maybe the problem is in curl not opening output
files in 'SHARED'
mode. Or if it does do, that whatever program the OP is using to read
the files is not
also trying to do so in a shared mode.

-- 
Jeremy Nicoll - my opinions are my own.
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ:        https://curl.haxx.se/docs/faq.html
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-04-22