Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can clipr_available() start a process? #45

Closed
jennybc opened this issue May 17, 2019 · 3 comments
Closed

Can clipr_available() start a process? #45

jennybc opened this issue May 17, 2019 · 3 comments

Comments

@jennybc
Copy link
Contributor

jennybc commented May 17, 2019

Since clipr_available() calls clipr_available_handler() and that tries to both read and write the clipboard, don't you think a call to clipr_available() could still create problems at CRAN, i.e. it could still tickle some process and leave it running?

Perhaps clipr_available_handler() should look more like this:

clipr_available_handler <- function(...) {
  if (!interactive()) {
    clipr_allow <- as.logical(Sys.getenv("CLIPR_ALLOW", "FALSE"))
    if (!clipr_allow) {
      return(FALSE)
    }
  }
  suppressWarnings({
    read_attempt <- try(read_clip(...), silent = TRUE)
    write_attempt <- try(write_clip(read_attempt, ...), silent = TRUE)
  })
  list(read = read_attempt, write = write_attempt)
}
@jennybc
Copy link
Contributor Author

jennybc commented Jul 17, 2019

I'm not entirely sure what's going on, but my spidey sense says that it is possible this issue explains why gitignore had trouble with CRAN:

ropensci/gitignore#7

@mdlincoln
Copy link
Owner

Hi @jennybc - thanks so much for your patience with my response. Life intervenes!

Yes, it makes a lot of sense to weave the CLIPR_ALLOW check more deeply throughout the package. I'll incorporate this along with the other suggestions.

@mdlincoln
Copy link
Owner

Closed with 17bdae6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants