[PATCH 5 of 9] stdio: catch StdioError in dispatch.run and clean up appropriately

Bryan O'Sullivan bos at serpentine.com
Tue Apr 11 13:54:00 EDT 2017


On Tue, Apr 11, 2017 at 6:54 AM, Yuya Nishihara <yuya at tcha.org> wrote:

> 255 would be better, too.
>

Done.


> > +    if util.safehasattr(req.ui, 'ferr'):
> > +        if err is not None and err.errno != errno.EPIPE:
> > +            req.ui.ferr.write('abort: %s\n' % err.strerror)
> > +        req.ui.ferr.close()
> > +    sys.exit(status)
>
> Is it safe to close stdout and stderr here? IIRC, Python interpreter can
> somehow crash due to closed stdout/err on Windows.
>

The interpreter will crash if the file descriptor backing a file handle is
closed, but closing the file handle itself isn't a problem.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170411/7ddec972/attachment.html>


More information about the Mercurial-devel mailing list