开发者

spawn get_line for stdin and have it work?

how do I get this to work

spawn(fun() -> io:get_line("Prompt>") end).

to where it would work as if it didn't开发者_如何学JAVA have the spawn. I tried standard_io and group_leader() but doesn't make difference.


Try

spawn(fun() -> timer:sleep(100),io:get_line("Prompt>") end).

What you see is a race condition between shell and your spawn/1. Generally when doing anything with io:get_line I would advice using 'erl -noshell -s Mod Fun' to start the program as that makes this issue go away.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜