Files
bun.sh/docs/guides/process/ctrl-c.md
Colin McDonnell 4c89c60867 Add files (#3826)
2023-07-26 14:59:39 -07:00

426 B

name
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().

process.on("SIGINT", () => {
  console.log("Ctrl-C was pressed");
  process.exit();
});

See Docs > API > Utils for more useful utilities.