Skip to content
Prev 387131 / 398502 Next

readline in function call with space in prompt.

Hello,

I have noticed a behavior that I don't understand. When I call the
following function from the prompt.
test <- function(){
    a <- readline("selection: ")
    a
}
I can only type one character and the readline function exits before I can
press enter.

however

test1 <- function(){
    a <- readline("selection:")
    a
}
works as expected.
However calling directly readline with a space in the prompt does what I
would expect.
It is the expected behavior or am I missing something?

Best regards,
Jeremie