[R-pkg-devel] Suppress R pop up message when using package OpenCL

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Dec 22 10:33:20 CET 2022


(Sorry about the previous message.)

В Thu, 22 Dec 2022 10:10:42 +0100
Quirin Stier <Quirin_Stier using gmx.de> пишет:

> Any ideas how to get rid of the message popping up?

You seem to be right that it's a package development question.
Currently, as long as there's a non-empty build log, OpenCL will show
it using R_ShowMesssage, or complain that it couldn't:

https://github.com/cran/OpenCL/blob/bcfcca930bffeac7f03f8ab1f9513d38fefe078b/src/ocl.c#L212-L224

I don't think that R_ShowMessage can be trapped in a portable way. In
the Windows GUI frontend, R_ShowMessage is implemented as a pop-up
window. If you run your program in Rterm, the log should be be printed
to the console instead of creating a pop-up window, so that could be a
quick (but far from perfect) workaround.

An improvement to the source code of OpenCL would be to replace the
R_ShowMessage calls with Rprintf("%s\n", message);, which at least can
be caught using capture.output().

I don't think that we have a C equivalent of message() (to be caught
using suppressMessages()). message() itself is implemented entirely in
R, both raising the condition and providing a default handler.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list