{"id":13595071,"url":"https://github.com/Detegr/rust-ctrlc","last_synced_at":"2025-04-09T10:32:46.813Z","repository":{"id":27353619,"uuid":"30828850","full_name":"Detegr/rust-ctrlc","owner":"Detegr","description":"Easy Ctrl-C handler for Rust projects","archived":false,"fork":false,"pushed_at":"2025-03-06T09:07:32.000Z","size":185,"stargazers_count":628,"open_issues_count":10,"forks_count":85,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T15:42:57.662Z","etag":null,"topics":["rust","signal-handling"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/ctrlc","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Detegr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2015-02-15T13:58:29.000Z","updated_at":"2025-03-31T03:34:41.000Z","dependencies_parsed_at":"2024-02-26T01:49:48.387Z","dependency_job_id":"c9bfa08d-34c2-4b81-9411-6a38709596a1","html_url":"https://github.com/Detegr/rust-ctrlc","commit_stats":{"total_commits":172,"total_committers":38,"mean_commits":4.526315789473684,"dds":0.4534883720930233,"last_synced_commit":"3502f44eca2fd006fd578d59e41471ca57d26191"},"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detegr%2Frust-ctrlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detegr%2Frust-ctrlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detegr%2Frust-ctrlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Detegr%2Frust-ctrlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Detegr","download_url":"https://codeload.github.com/Detegr/rust-ctrlc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248020593,"owners_count":21034459,"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":["rust","signal-handling"],"created_at":"2024-08-01T16:01:43.410Z","updated_at":"2025-04-09T10:32:41.803Z","avatar_url":"https://github.com/Detegr.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# CtrlC\nA simple easy to use wrapper around Ctrl-C signal.\n\n[Documentation](http://detegr.github.io/doc/ctrlc/)\n\n## Example usage\n\nIn `cargo.toml`:\n\n```toml\n[dependencies]\nctrlc = \"3.4\"\n```\n\nthen, in `main.rs`\n\n```rust\nuse std::sync::mpsc::channel;\nuse ctrlc;\n\nfn main() {\n    let (tx, rx) = channel();\n    \n    ctrlc::set_handler(move || tx.send(()).expect(\"Could not send signal on channel.\"))\n        .expect(\"Error setting Ctrl-C handler\");\n    \n    println!(\"Waiting for Ctrl-C...\");\n    rx.recv().expect(\"Could not receive from channel.\");\n    println!(\"Got it! Exiting...\"); \n}\n```\n\n#### Try the example yourself\n`cargo build --examples \u0026\u0026 target/debug/examples/readme_example`\n\n## Handling SIGTERM and SIGHUP\nAdd CtrlC to Cargo.toml using `termination` feature and CtrlC will handle SIGINT, SIGTERM and SIGHUP.\n\n## License\n\nLicensed under either of\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you shall be dual licensed as above, without any\nadditional terms or conditions.\n\n## Similar crates\n\nThere are alternatives that give you more control over the different signals and/or add async support.\n\n- [signal-hook](https://github.com/vorner/signal-hook)\n- [tokio::signal](https://docs.rs/tokio/latest/tokio/signal/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDetegr%2Frust-ctrlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDetegr%2Frust-ctrlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDetegr%2Frust-ctrlc/lists"}