aboutsummaryrefslogtreecommitdiff
path: root/docs/guides/process/ctrl-c.md
diff options
context:
space:
mode:
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.