> ## Documentation Index
> Fetch the complete documentation index at: https://bun.ll1025.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 监听 CTRL+C

`ctrl+c` 快捷键会向正在运行的进程发送*中断信号*。通过监听 `SIGINT` 事件来拦截它。要关闭进程，必须显式调用 `process.exit()`。

```ts process.ts icon="https://mintcdn.com/span-inc/82N53aP7NFbaCVSl/icons/typescript.svg?fit=max&auto=format&n=82N53aP7NFbaCVSl&q=85&s=787d39d6a7d96d7f9540dc74344eba23" theme={null}
process.on("SIGINT", () => {
  console.log("按下了 Ctrl-C");
  process.exit();
});
```

***

参见 [工具](/runtime/utils) 了解更多实用工具。
