> ## Documentation Index
> Fetch the complete documentation index at: https://bun-1dd33a4e-farm-15490b5d-test-done-error-hook.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Listen to OS signals

Bun supports the Node.js `process` global, including the `process.on()` method for listening to OS signals.

```ts theme={null}
process.on("SIGINT", () => {
  console.log("Received SIGINT");
});
```

***

If you don't know which signal to listen for, you listen to the [`"beforeExit"`](https://nodejs.org/api/process.html#event-beforeexit) and [`"exit"`](https://nodejs.org/api/process.html#event-exit) events.

```ts theme={null}
process.on("beforeExit", code => {
  console.log(`Event loop is empty!`);
});

process.on("exit", code => {
  console.log(`Process is exiting with code ${code}`);
});
```

***

See [Docs > API > Utils](/runtime/utils) for more useful utilities.
