Skip to content

[BUG] stdlib: exit isn't declared -> Never #7297

Closed

Description

@xvbcfj

Bug description

from std.sys import exit

def parse_or_exit(text: String) -> Int:
    try:
        return Int(text)
    except:
        print("not a number:", text)
        exit(2)

def main():
    print(parse_or_exit("42"))
t.mojo:3:5: error: return expected at end of function with results
def parse_or_exit(text: String) -> Int:
    ^

System information

❯ pixi run mojo -v
Mojo 1.2.0.dev2026101405 (48ec2d26)

Activity

  1. added
    bug
    mojo
    needs: triage
    on Oct 14, 2026
  2. NathanSWard commented on Oct 14, 2026

    @NathanSWard
    Contributor

    Thanks! Looks like a pretty simple fix and makes sense to me :)

  3. added
    Team: Mojo Libraries
    on Oct 14, 2026
  4. added a commit that references this issue on Oct 24, 2026
    448e831
  5. added a commit that references this issue on Nov 15, 2026
    c749d5e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team: Mojo Librariesacceptedbugmojoneeds: triagerepro: confirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions