Permalink
Browse files

Merge pull request #11 from muxspace/master

Properly support password authentication
  • Loading branch information...
2 parents c3b0c4a + a42854e commit 51ac7c4f9c065b262751f55851cb30344388e6b2 @bwlewis committed Mar 19, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 R/controlCMD.R
View
@@ -18,7 +18,7 @@
}
`redisConnect` <-
-function(host='localhost', port=6379, returnRef=FALSE, timeout=2678399L)
+function(host='localhost', port=6379, returnRef=FALSE, timeout=2678399L, password=NULL)
{
.redisEnv$current <- new.env()
# R nonblocking connections are flaky, especially on Windows, see
@@ -35,6 +35,12 @@ function(host='localhost', port=6379, returnRef=FALSE, timeout=2678399L)
# Count is for nonblocking communication, it keeps track of the number of
# getResponse calls that are pending.
assign('count',0,envir=.redisEnv$current)
+ if (!is.null(password)) tryCatch(redisAuth(password),
+ error=function(e) {
+ cat(paste('Error: ',e,'\n'))
+ close(con);
+ rm(list='con',envir=.redisEnv$current)
+ })
tryCatch(.redisPP(),
error=function(e) {
cat(paste('Error: ',e,'\n'))

0 comments on commit 51ac7c4

Please sign in to comment.