Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add [Symbol.dispose] in some bun apis #10818

Merged
merged 10 commits into from May 7, 2024
Merged

Conversation

paperdave
Copy link
Collaborator

{
  using server = Bun.serve({
    port: 0,
    fetch() {
      return new Response("OK");
    },
  });
  
  // do something with server
}

// the server is closed as `server` is out of scope.
  • Bun.spawn
  • Bun.serve
  • Bun.listen
  • Bun.connect
  • JSCallback

Copy link

github-actions bot commented May 4, 2024

@Jarred-Sumner, your commit has failing tests :(

💪 1 failing tests Darwin AARCH64

💻 3 failing tests Darwin x64 baseline

💻 2 failing tests Darwin x64

🪟💻 14 failing tests Windows x64 baseline

🪟💻 13 failing tests Windows x64

View logs

@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented May 5, 2024

@paperdave

The following code crashes with SIGTRAP:

import {spawn, serve} from 'bun';

using server = serve({
    port: 0,
    async fetch(req) {
        await using process =  spawn({
            cmd: ["ffmpeg", "--version"],
            stdout: "pipe",
        });

        return new Response(process.stdout);
    }
});

const response = await fetch(server.url)

console.log(await response.text());

Edit: fixed in #10840

@Jarred-Sumner Jarred-Sumner merged commit f9be0be into main May 7, 2024
21 of 22 checks passed
@Jarred-Sumner Jarred-Sumner deleted the dave/bun-api-dispose branch May 7, 2024 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants