# exit

```ts
function* exit(status: number, message?: string): Operation<void>
```

Halt process execution immediately and initiate shutdown. If a message is
provided, it will be logged to the console after shutdown:

```js
if (invalidArgs()) {
  yield* exit(5, "invalid arguments")
}
```
### Parameters


**status**: number


the exit code to use for the process exit


**message**<span class="inline-block bg-sky-100 rounded px-2 text-sm text-sky-900 mx-1">optional</span>: string


message to print to the console before exiting.
### Return Type


[Operation](https://frontside.com/effection/api/v4/Operation.md)&lt;void&gt;


an operation that exits the program

[View code](https://github.com/thefrontside/effection/tree/effection-v4.2.0/lib/main.ts#L22)
