-
-
Notifications
You must be signed in to change notification settings - Fork 405
Open
Labels
Description
Summary
Summary:
-
User Issue: @Nikivi is experiencing issues with a CLI-based development workflow using
bun --watch
and@effect/cli
. The process quits immediately upon saving a file, ignoring the--watch
flag. -
Rapid Iterations and Insight:
- @maxwellbrown suggests switching from
BunRuntime.runMain
toEffect.runPromise
. - @Nikivi confirms that switching to
Effect.runPromise
works but raises concerns about potential drawbacks. - @MichaelArnaldi points out that using
Effect.runPromise
without proper cleanup can lead to resource leakage.
- @maxwellbrown suggests switching from
-
Main Technical Points:
Effect.runPromise
in development bypasses the process exit handlers, causing potential resource leaks.- The
runMain
method is crucial for setting up event listeners to handle process signals for clean exits. - There is a discussion around customizing the runtime setup to work in both development (
--watch
) and production environments.
-
Key Actionable Insights:
- In Development: Use
Effect.runPromise
to prevent immediate process exit when running in watch mode. - In Production: Switch back to
BunRuntime.runMain
to ensure proper cleanup and resource management. - Potential use of environment variables to conditionally switch between
runPromise
andrunMain
.
- In Development: Use
-
Investigation and Fixes:
- @TimSmart creates a PR to address the issue by changing the
process.exit
behavior. - Discussion about understanding why unregistering signal handlers did not allow the process to complete naturally.
- @TimSmart creates a PR to address the issue by changing the
Key Takeaways:
- Temporary Solution: Use
Effect.runPromise
in watch mode for development but be aware of potential resource leaks. - Proper Cleanup: Ensure proper event listener binding and cleanup strategies in production using
runMain
. - Community Collaboration: Contributions from community members and maintainers helped to quickly identify and propose solutions.
- Further Investigation: Suggested creating a minimal reproduction and exploring why certain signal handling behaviors prevented clean process termination.
Discord thread
https://discord.com/channels/795981131316985866/1287372464548216883