mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
19 lines
511 B
Plaintext
19 lines
511 B
Plaintext
---
|
|
title: Listen for CTRL+C
|
|
sidebarTitle: Listen for CTRL+C
|
|
mode: center
|
|
---
|
|
|
|
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()`.
|
|
|
|
```ts process.ts icon="/icons/typescript.svg"
|
|
process.on("SIGINT", () => {
|
|
console.log("Ctrl-C was pressed");
|
|
process.exit();
|
|
});
|
|
```
|
|
|
|
---
|
|
|
|
See [Docs > API > Utils](/runtime/utils) for more useful utilities.
|