[R-SIG-Mac] Disable readline echo in R for mac GUI
Dr Eberhard W Lisse
el @ending from li@@e@n@
Thu Nov 15 14:49:09 CET 2018
On my Mojave iMac
commandArgs()
returns
on RStudio
[1] "RStudio" "--interactive"
on Mac GUI
[1] "R" "--no-save" "--no-restore-data" "--gui=aqua"
and on R command line
[1] "/Library/Frameworks/R.framework/Resources/bin/exec/R"
so maybe test for that?
el
On 15/11/2018 15:06, Jeroen Ooms 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