askpass icon indicating copy to clipboard operation
askpass copied to clipboard

askpass in RStudio when running knit cannot be made interactive with r_lib_interactive

Open spgarbet opened this issue 1 year ago • 11 comments

options(rlib_interactive = TRUE) no longer works to force it to be interactive. Similar to #3

I downloaded the code and put a browser() call at the beginning of is_interactive() and a cat statement and it's never called. I.e.

is_interactive <- function() {
  opt <- getOption("rlib_interactive")
  cat("YYAAAAABBAAA DABBA DOOO")
  browser()
  if (isTRUE(opt)) {
    TRUE

This is never called. Problem is verified on MacOS, and Ubuntu. We tried multiple versions and updates to no avail.

I suspect an RStudio update did something.

spgarbet avatar May 14 '23 01:05 spgarbet

@gaborcsardi do you know if rlib_interactive changed?

jeroen avatar May 14 '23 13:05 jeroen

I don't really understand the question or what is going on, but FWIW I don't think RStudio does anything with the rlib_interactive option, it never did AFAIK. It is an option that you need to set for yourself, and it is intended for testing. Also, much of the tidyverse uses the rlang_interactive for this purpose.

gaborcsardi avatar May 14 '23 15:05 gaborcsardi

The problem is that on current RStudio when running "knit" the popup never appears and it returns NULL. The documentation said to use options(rlib_interactive = TRUE) to work to force it to popup. This doesn't work. It did at some point in the past. I don't know what's changed, but it's broken at present.

The is_interactive call is never triggered is possibly part of the problem.

spgarbet avatar May 14 '23 17:05 spgarbet

@spgarbet Is it possible that you are using askpass 1.1 that does not use is_interactive()?

gaborcsardi avatar May 14 '23 17:05 gaborcsardi

> packageVersion("askpass")
[1] ‘1.1.0’

But the problem remains, how do I get it to make a popup when running knit from inside RStudio?

spgarbet avatar May 14 '23 18:05 spgarbet

I would try installing a newer version of askpass, and set the rlib_interactive option to TRUE.

gaborcsardi avatar May 14 '23 18:05 gaborcsardi

How do I install a newer version than 1.1.0?

https://github.com/r-lib/askpass/blob/main/DESCRIPTION#L4

spgarbet avatar May 14 '23 18:05 spgarbet

Install the version on GitHub.

gaborcsardi avatar May 14 '23 18:05 gaborcsardi

Did you click the link I just posted? The version on github is 1.1.0.

spgarbet avatar May 14 '23 18:05 spgarbet

Also, I installed the source from github and was working from that when I posted the above snippet.

spgarbet avatar May 14 '23 18:05 spgarbet

Right, never mind my comments then....

gaborcsardi avatar May 14 '23 19:05 gaborcsardi