Skip to content

signal-exit onExit callback not triggered in Bun during process shutdown #29194

@kevgeoleo

Description

@kevgeoleo

What version of Bun is running?

1.3.11-canary.1+9e93bfa1b

What platform is your computer?

Linux 5.10.0-12-amd64 x86_64 x86_64

What steps can reproduce the bug?

Hi,

I would like to report a behavior in Bun that can be reproduced using the below snippet:

import { onExit } from 'signal-exit';

onExit(function (code, signal) {
  console.log('process exited!');
}, { alwaysLast: true });

What is the expected behavior?

root@KContainer:~/21757# node test.mjs
process exited!
root@KContainer:~/21757# deno run -A test.mjs
process exited!

What do you see instead?

Bun does not print anything and exits
Bun does not consistently execute signal-exit onExit handlers during process termination, while Node.js and Deno do.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions