The ctrl+c shortcut sends an interrupt signal to the running process. This signal can be intercepted by listening for the SIGINT event. If you want to close the process, you must explicitly call process.exit().
process.on("SIGINT", () => {
console.log("Ctrl-C was pressed");
process.exit();
});
1---2name: bun-listen-for-ctrl-c3description: Listen for CTRL+C4---56# Listen for CTRL+C78The `ctrl+c` shortcut sends an *interrupt signal* to the running process. This signal can be intercepted by listening for the `SIGINT` event. If you want to close the process, you must explicitly call `process.exit()`.910```ts process.ts icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}11process.on("SIGINT", () => {12 console.log("Ctrl-C was pressed");13 process.exit();14});15```1617***1819See [Docs > API > Utils](/runtime/utils) for more useful utilities.
Run npx skillmds@latest add jarle/bun-listen-for-ctrl-c in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Listen for CTRL+C It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
jarle (@jarle) published this skill. Their other Agent Skills are listed on their SkillMD profile.