Calling readline(stdin) inside __init__() freezes

question
#1

what is the problem with this code?
when I run it, it stops for user input due to readline but as I enter something it freezes.
And when I used Ctrl + C, it showed a warning.

WARNING: Force throwing a SIGINT
module A

    function __init__()
        load = (readline(stdin) === "true") ? true : false
        if load
            print("ok")
        end
    end

end

using .A
#2

Is this in Atom or command line REPL?
It works for me as expected at a command line REPL if I replace === by ==.
AFAIK readline is broken in Atom.

#3

This is in atom.
What else can I use in atom.

#4

Depends on your purpose. readavailable does work for me most of the times, but is less convenient if you want to catch more than one character.

#5

Relevant issue.

Note that you can still use readline, but it’s not very intuitive:
Peek%202019-03-12%2012-25

#6

Actually , My problem is that I am not able to use readline() inside __init__().
Outside __init()__ , readline() works fine.
I just want to take an argument from user when I import my custom module is there any other way to do so??