Append-mode I/O on Windows and process I/O redirection
Martin Buchholz
martinrb at google.com
Sat Jun 7 21:18:42 UTC 2008
In the below, I suggested someone might complain if
process redirection in APPEND mode failed to allow subprocesses
to do non-appending I/O operations.
But.... process I/O redirection is a new feature,
so it would not be an incompatible change,
so I now think it is the Right Thing to do.
You don't want subprocesses to be able to truncate log files
that they've been politely asked only to append to.
Martin
On Fri, Jun 6, 2008 at 11:09 PM, Martin Buchholz <martinrb at google.com> wrote:
> What should the process code do, given that it doesn't control
> how the subprocess will perform individual writes?
>
> Well, we could simply set the file position at the end of the file,
> which is "pretty good", but not quite right (concurrent writes
> may cause one of the writes to be lost). Perhaps the ReOpenFile function
> http://msdn.microsoft.com/en-us/library/aa365497(VS.85).aspx
> can be used to create a new HANDLE with FILE_APPEND_DATA and
> without FILE_WRITE_DATA and passing that to the subprocess.
> Will someone then in turn complain
> that the child process can't truncate its standard output??!
> Hmmm....
More information about the core-libs-dev
mailing list