Replies: 2 comments
-
So, until mojo makes this more friendly, you will need to make a System Call to do this. # nonzero.mojo
from sys.intrinsics import external_call
fn main() raises:
external_call["exit", Int, Int](20) ~/Projects/anting via 🐍 v3.10.13 (.venv)
❯ : mojo build nonzero.mojo
/home/stoner/Projects/anting/nonzero.mojo:4:36: warning: 'Int' value is unused
external_call["exit", Int, Int](20)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
_ = Then you can run it ➜ ./nonzero
➜ echo $?
20 Took me awhile to figure out that mojo requires |
Beta Was this translation helpful? Give feedback.
0 replies
-
ah ha. nice. i tried doing it through Python but that didn't actually do anything do to the way it's wrapped (i presume). i knew there must be some (possibly non-beautiful) way to do it. that worked perfectly, thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can't find anything in Mojo equivalent to:
Am I just missing it?
Beta Was this translation helpful? Give feedback.
All reactions