I'm trying to write a getpass function for R that will work with Rstudio. I've tried using the getpass C function (*nix, with Rcpp) as well as using the getpass from python using rPython, and both seem to work in the terminal, but cause the Rstudio prompt to freeze after entering a password and hitting return.
The output from python's get pass is,
/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/getpass.py:83: GetPassWarning: Can not control echo on the terminal.
passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
and using getpass(const char *prompt);
I just get the password prompt that never returns to the R prompt.
As requested some code snippets that work in the terminal but not in R-studio,
library(rPython)
python.exec("import getpass")
pass = python.get("getpass.getpass()")
the Rcpp/inline code,
library(inline)
str = 'std::string pass = (const char *) getpass("Password: ");\n;\n return(wrap(pass));'
testfun = cxxfunction(signature(),body=str,plugin="Rcpp")
testfun()
Note I'm on a mac but it should be the same on other *ix boxes that have getpass()
.
Any clues?