Message-ID: <dfb0c765-9a90-a65f-9730-d6718c42087a@gmail.com>
Date: 2020-02-18T14:51:08Z
From: Duncan Murdoch
Subject: [R-pkg-devel] Catching console messages from libGL
In-Reply-To: <20200218001048.4b035455@Tarkus>
On 17/02/2020 4:10 p.m., Ivan Krylov wrote:
> On Mon, 17 Feb 2020 14:56:31 -0500
> Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
>> So how do I capture stderr (or, off topic here, how do I get libGL to
>> be quiet)?
>
> libGL seems to only offer bad news in this regard: it writes directly
> to stderr [1] and does not seem to offer a way to silence the
> _LOADER_FATAL messages [2], which "failed to load driver: %s" are.
>
> (You have found that out while I was preparing the message.)
>
> As far as I understand do_sink(), it does not touch the actual stdout
> or stderr, only R's wrappers of them. You probably know better than me
> how portable would it be to try to reassign stderr (which the standard
> says is a macro) to open_memstream() (which is POSIX.1-2008 only).
>
Thanks for that last paragraph. I've decided to temporarily redirect
stderr to /dev/null (or nul on Windows) using dup() and dup2() in the
C++ code. I'll make this optional; if people want to see those
messages, there'll be a way to enable them again. My tests show that
this does silence libGL.
Duncan Murdoch