> -----Original Message----- > From: Branko Čibej [mailto:br...@wandisco.com] > Sent: maandag 17 augustus 2015 11:44 > To: dev@subversion.apache.org > Subject: Re: svn commit: r1696225 - in /subversion/trunk/subversion: > libsvn_subr/stream.c tests/libsvn_ra/ra-test.c > > On 17.08.2015 11:40, rhuij...@apache.org wrote: > > Author: rhuijben > > Date: Mon Aug 17 09:40:04 2015 > > New Revision: 1696225 > > > > URL: http://svn.apache.org/r1696225 > > Log: > > Following up on r1696222, implement polling on pipes on Windows. > > > > Note that PeekNamedPipe() also works on unnamed pipes, such as those > created > > by apr to hook stdin and stdout of subprocesses. > > > > * subversion/libsvn_subr/stream.c > > (data_available_handler_apr): Implement polling on pipes for Win32. > > > > * subversion/tests/libsvn_ra/ra-test.c > > (test_funcs): Remove Windows specific XFail marking. > > > > Modified: > > subversion/trunk/subversion/libsvn_subr/stream.c > > subversion/trunk/subversion/tests/libsvn_ra/ra-test.c > > > > Modified: subversion/trunk/subversion/libsvn_subr/stream.c > > URL: > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/stream. > c?rev=1696225&r1=1696224&r2=1696225&view=diff > > > ================================================================ > ============== > > --- subversion/trunk/subversion/libsvn_subr/stream.c (original) > > +++ subversion/trunk/subversion/libsvn_subr/stream.c Mon Aug 17 09:40:04 > 2015 > > @@ -942,8 +942,9 @@ static svn_error_t * > > data_available_handler_apr(void *baton, svn_boolean_t *data_available) > > { > > struct baton_apr *btn = baton; > > - apr_pollfd_t pfd; > > apr_status_t status; > > +#if !defined(WIN32) || APR_FILES_AS_SOCKETS > > + apr_pollfd_t pfd; > > int n; > > > > pfd.desc_type = APR_POLL_FILE; > > @@ -973,6 +974,24 @@ data_available_handler_apr(void *baton, > > "failed")), > > NULL); > > } > > +#else > > + HANDLE h; > > + DWORD dwAvail; > > + status = apr_os_file_get(&h, btn->file); > > + > > + if (status) > > + return svn_error_wrap_apr(status, NULL); > > + > > + if (PeekNamedPipe(h, NULL, 0, NULL, &dwAvail, NULL)) > > + { > > + *data_available = (dwAvail > 0); > > + return SVN_NO_ERROR; > > + } > > + > > + return svn_error_create(SVN_ERR_STREAM_NOT_SUPPORTED, > > + svn_error_wrap_apr(apr_get_os_error(), NULL), > > + _("Windows doesn't support polling on files")); > > +#endif > > } > > Interesting solution ... should be in APR, I guess? I'm wondering it's > really safe to expect that the socked we got from APR is really an > (un)named pipe?
The only other case would be a normal file, which would just return an error. Apr should be able to tell the difference between pipes and files for the handles it created itself... Working on a patch for apr now. (I think it is possible to ask apr to wrap an existing os handle...) Bert