Using the input function will cause Mojo to crash.
Using the input function in the main function causes mojo to crash.
Please tell me why it crashes and how to work around it.
This is the mojoproject.toml
3 Replies
I have had this problem for a while now. There was an issue loggged in September where someone mentioned that if you just run the code it won't work, but if you build first it fixes the issue, but for me neither works, I get the same segfault every time (incidentally also on silicon osx!). I have mentioned it a few times here but no-one seems responsive (I mean, i/o is kind of important in computing, right??) so I just import python and use it's input function. Hopefully someone working on the stdlib can have a look at it at some point
Here is the issue: https://github.com/modularml/mojo/issues/3479
GitHub
[BUG] Program with input() crashes when run directly by mojo CLI · ...
Bug description I'm encountering a crash with a simple Mojo v24.5 program that uses the input() method when I run the program directly with the mojo CLI. However, when I compile the same progra...
Does it also crash if you try it in nightly? I know they pushed some changes to the input function shortly after 24.5 was released.