Skip to content

Commit

Permalink
Merge pull request #96 from FredHutch/ldap
Browse files Browse the repository at this point in the history
Suppress warnings from get_full_name() when fragile caught system calls fail
  • Loading branch information
slager authored Sep 30, 2024
2 parents baa672e + dff7438 commit 9e6324c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# VISCfunctions (development version)

* Suppress warning from get_full_name() when fragile ldapsearch system call fails on Linux and macOS (#96)

# VISCfunctions 1.2.3

* Use shorter git hash in reproducibility table (#92)
Expand Down
4 changes: 2 additions & 2 deletions R/reproducibility_tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ get_full_name <- function(id = NULL){
Linux = {
if (is.null(id)) {id <- Sys.getenv("USER")}
myargs <- paste0("-x -h ldapint.pc.scharp.org -b dc=scharp,dc=org uid=", id)
user <- tryCatch({system2("ldapsearch", args = myargs, stdout = TRUE)},
user <- tryCatch({system2("ldapsearch", args = myargs, stdout = TRUE, stderr = FALSE)},
warning = function(w){NULL},
error = function(e){NULL})
user <- user[grep("cn:", user)]
Expand All @@ -48,7 +48,7 @@ get_full_name <- function(id = NULL){
Darwin = {
if (is.null(id)) {id <- Sys.getenv("USER")}
myargs <- paste0("-x -h ldapint.pc.scharp.org -b dc=scharp,dc=org uid=", id)
user <- tryCatch({system2("ldapsearch", args = myargs, stdout = TRUE)},
user <- tryCatch({system2("ldapsearch", args = myargs, stdout = TRUE, stderr = FALSE)},
warning = function(w){NULL},
error = function(e){NULL})
user <- user[grep("cn:", user)]
Expand Down

0 comments on commit 9e6324c

Please sign in to comment.