aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/process/ctrl-c.md
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-07-26 14:59:39 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-26 14:59:39 -0700
commit4c89c60867591b50e0b31bf5009fd5ad6a3cebe1 (patch)
treefc1d2f47309c0345a850933496baa40d94bfdcbb /docs/guides/process/ctrl-c.md
parent6bfee02301a2e2a0b79339974af0445eb5a2688f (diff)
downloadbun-4c89c60867591b50e0b31bf5009fd5ad6a3cebe1.tar.gz
bun-4c89c60867591b50e0b31bf5009fd5ad6a3cebe1.tar.zst
bun-4c89c60867591b50e0b31bf5009fd5ad6a3cebe1.zip
Add files (#3826)
Diffstat (limited to 'docs/guides/process/ctrl-c.md')
-rw-r--r--docs/guides/process/ctrl-c.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/guides/process/ctrl-c.md b/docs/guides/process/ctrl-c.md
new file mode 100644
index 000000000..b880cf62c
--- /dev/null
+++ b/docs/guides/process/ctrl-c.md
@@ -0,0 +1,16 @@
+---
+name: Listen for CTRL+C
+---
+
+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.on("SIGINT", () => {
+ console.log("Ctrl-C was pressed");
+ process.exit();
+});
+```
+
+---
+
+See [Docs > API > Utils](/docs/api/utils) for more useful utilities.