[R-SIG-Mac] Disable readline echo in R for mac GUI
Jeroen Ooms
jeroenoom@ @end|ng |rom gm@||@com
Fri Jan 25 20:37:52 CET 2019
If anyone else is also interested in this, I found a satisfactory
solution to prompt for passwords in R.app using AppleScript. It is now
available in the 'askpass' package on CRAN.
On Thu, Nov 15, 2018 at 5:06 AM Jeroen Ooms <jeroenooms using gmail.com> wrote:
>
> When prompting the user for a password, we need to temporarily disable
> echo. In a tty we can call posix stty -echo (example below). The
> RStudio GUI has a native password entry function that can be triggered
> via getOption('askpass'). Is there simple method to prompt for a
> password in the R for Mac GUI (without depending on shiny or tcltk)?
>
> readline_password <- function(prompt = "Please enter password\n"){
> if(isatty(stdin())){
> if(system('stty -echo') == 0){
> on.exit(system('stty echo'))
> }
> }
> base::readline(prompt)
> }
More information about the R-SIG-Mac
mailing list