intales / gazelle

Lightweight Dart HTTP server framework for modular web development. Build APIs with speed and simplicity.
https://docs.gazelle-dart.dev
BSD 3-Clause "New" or "Revised" License
25 stars 6 forks source link

Update stdin_broadcast.dart #28

Closed soltanzadehErfan closed 1 month ago

soltanzadehErfan commented 1 month ago

Signal Handler Setup Method: Moved signal handler setup to its own method for clarity.

Controller Lifecycle Management: Added proper lifecycle management for the StreamController, ensuring terminal settings are reset on stream cancellation.

Exit on Signal: Added exit(0); in _resetTerminalSettings to ensure the application exits gracefully after cleaning up.

Error Logging: Used stderr.writeln instead of print for error messages to ensure they go to the standard error stream.

Platform Independence: Signal handling for sigint and sigterm properly checked for Windows compatibility.

Documentation: Added comments for better understanding and maintainability.