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

Never Resolving Promise #23

Open
bh2smith opened this issue Nov 19, 2024 · 0 comments
Open

Never Resolving Promise #23

bh2smith opened this issue Nov 19, 2024 · 0 comments

Comments

@bh2smith
Copy link
Contributor

await new Promise(() => {});

This creates a Promise that never resolves, effectively creating a memory leak. While it does keep the process running, there are better ways to handle this.

  // Handle process termination gracefully
  const cleanup = () => {
    serverProcess.kill();
    agentProcess.kill();
    process.exit(0);
  };

  process.on('SIGINT', cleanup);
  process.on('SIGTERM', cleanup);

  // If you need to keep the process running, use process.stdin.resume()
  process.stdin.resume();
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

No branches or pull requests

1 participant