File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ default_backend_auto <- function() {
8585 backend_secret_service $ new()$ is_available()) {
8686 backend_secret_service
8787
88- } else if (" file" %in% names(known_backends )) {
88+ } else if (" file" %in% names(known_backends ) && file_backend_works() ) {
8989 backend_file
9090
9191 } else {
@@ -97,6 +97,21 @@ default_backend_auto <- function() {
9797 }
9898}
9999
100+ file_backend_works <- function () {
101+ opt <- options(rlib_interactive = FALSE )
102+ on.exit(options(opt ), add = TRUE )
103+ tryCatch({
104+ kb <- backend_file $ new()
105+ krs <- kb $ keyring_list()
106+ def <- kb $ keyring_default()
107+ if (! def %in% krs $ keyring ) {
108+ return (FALSE )
109+ }
110+ kb $ list ()
111+ TRUE
112+ }, error = function (err ) FALSE )
113+ }
114+
100115backend_factory <- function (name ) {
101116 assert_that(is_string(name ))
102117 if (! name %in% names(known_backends )) {
You can’t perform that action at this time.
0 commit comments