{"id":23092299,"url":"https://github.com/sourcefrog/sysexit","last_synced_at":"2026-01-12T07:28:32.574Z","repository":{"id":142466049,"uuid":"416392179","full_name":"sourcefrog/sysexit","owner":"sourcefrog","description":"Rust module that provides exit codes for programs","archived":false,"fork":false,"pushed_at":"2021-10-12T15:45:32.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T06:43:39.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sourcefrog.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-12T15:26:10.000Z","updated_at":"2021-10-12T15:26:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a53e749-7320-49b8-b6c6-b1221e7ece34","html_url":"https://github.com/sourcefrog/sysexit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcefrog%2Fsysexit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcefrog%2Fsysexit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcefrog%2Fsysexit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcefrog%2Fsysexit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcefrog","download_url":"https://codeload.github.com/sourcefrog/sysexit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247055122,"owners_count":20876136,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-16T21:32:04.541Z","updated_at":"2026-01-12T07:28:31.965Z","avatar_url":"https://github.com/sourcefrog.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"sysexit\n=======\n\nRust module that provides and recognises exit codes for programs.\n\n\nUsage\n-----\n\nTo semantically set the exit code of a program:\n\n```rust\nextern crate sysexit;\n\nuse std::process;\n\nfn main() {\n    println!(\"Hello world!\");\n    process::exit(sysexit::Success);\n}\n```\n\nOr to deduce the exit code of a subprocess:\n\n```rust\nextern crate sysexit;\n\nuse std::process;\n\nlet exit_status = process::Command::new(\"sh\")\n    .arg(\"-c\").arg(format!(\"exit {}\", 74))\n    .status()\n    .expect(\"failed to run sh(1)\");\nlet exit_code = sysexit::from_status(exit_status);\nprintln!(\"{}\", exit_code);\n```\n\nThis outputs:\n\n\ti/o error (74)\n\n\nDescription\n-----------\n\nThe choice of an appropriate exit value is often ambigeous and\nwhilst it is impossible to provide an authoritative anthology that\napplies under all circumstances, this crate attempts to collec the\nmost frequently recognised exit codes across Unix systems.\n\nExit statuses fall between 0 and 255 (inclusive), and codes greater than\nzero indicate failure.  The range 125–128 is reserved shell-specific\nstatuses, including shell builtins and compound commands.  The range\n129–154 is reserved fatal signals, explained below.\n\nAs a basis it encodes the exit codes of [sysexits(3)] from OpenBSD\n(64–78), exit statuses used by [bash(1)], supplemented by codes\ncreated by shells when the command is terminated by a fatal signal.\nWhen the fatal signal is a number _N_, the latter follows bash’s\nstrategy of using the value 128 + _N_ as the exit status.  This means\nthat the `SIGHUP` (1) signal will be recognised as the exit code\nfor the number 129.\n\n\nInterface\n---------\n\nYou can see the full API documentation on \u003chttps://docs.rs/sysexit\u003e.\n\n### [`pub fn from_status(status: std::process::ExitStatus) -\u003e sysexit::Code`]\nConverts [`std::process::ExitStatus`] to [`sysexit::Code`].\n\n### [`pub fn is_success(status: std::process::ExitStatus) -\u003e bool`]\nDetermines if the provided [`std::process::ExitStatus`] was successful.\n\n### [`pub fn is_error(status: std::process::ExitStatus) -\u003e bool`]\nDetermines if the provided [`std::process::ExitStatus`] was jnsuccessful.\n\n### [`pub fn is_reserved(n: i32) -\u003e bool`]\nTest if the provided exit code is reserved and has a special meaning.\n\n### [`pub fn is_valid(n: i32) -\u003e bool`]\nTest if the provided exit code is valid, in other words that it is\nwithin the 0-255 (inclusive) range.\n\n\nSee also\n--------\n\n[_exit(2)], [exit(3)], [sysexits(3)], [bash(1)]\n\n\nHistory\n-------\n\nThis library is based on the `sysexits.h` file that first appeared\nin 4.0BSD for use by the delivermail utility, later renamed to\n[sendmail(8)].  It was further expanded with fatal signals from\n[bash(1)].\n\nYou can consult the [CHANGES.md] file for a record of all notable\nchanges to the library.\n\n\nAuthors\n-------\n\nEric Allman invented the `sysexits.h` file in 1980.  Much of the\ndocumentation for this library is based on the [sysexits(3)] man\npage written by Joerg Wunsch, based on Eric’s original comments.\nThe `is_reserved` and `is_valid` functions were written by Richard\nFussenegger.  The Rust crate was written by [Andreas Tolfsen].\n\n\nBugs\n----\n\nThe choice of an appropriate exit value is often ambigeous.\n\n\n[Andreas Tolfsen]: https://sny.no/\n[CHANGES.md]: https://github.com/andreastt/sysexit/blob/master/CHANGES.md\n[_exit(2)]: https://man.openbsd.org/_exit.2\n[`pub fn from_status(status: std::process::ExitStatus) -\u003e sysexit::Code`]: https://docs.rs/sysexit/newest/sysexit/fn.from_status.html\n[`pub fn is_error(status: std::process::ExitStatus) -\u003e bool`]: https://docs.rs/sysexit/newest/sysexit/fn.is_error.html\n[`pub fn is_reserved(n: i32) -\u003e bool`]: https://docs.rs/sysexit/newest/sysexit/fn.is_reserved.html\n[`pub fn is_success(status: std::process::ExitStatus) -\u003e bool`]: https://docs.rs/sysexit/newest/sysexit/fn.is_success.html\n[`pub fn is_valid(n: i32) -\u003e bool`]: https://docs.rs/sysexit/newest/sysexit/fn.is_valid.html\n[`std::process::ExitStatus`]: https://doc.rust-lang.org/std/process/struct.ExitStatus.html\n[`sysexit::Code`]: https://docs.rs/sysexit/newest/enum.Code.html\n[`sysexit::Unknown`]: https://docs.rs/sysexit/newest/enum.Code.html#variant.Unknown\n[sysexits(3)]: https://man.openbsd.org/sysexits.3\n[bash(1)]: https://linux.die.net/man/1/bash\n[exit(3)]: https://man.openbsd.org/exit.3\n[sendmail(8)]: https://man.openbsd.org/sendmail.8\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcefrog%2Fsysexit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcefrog%2Fsysexit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcefrog%2Fsysexit/lists"}