RITlug / teleirc

Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
https://docs.teleirc.com/
GNU General Public License v3.0
141 stars 45 forks source link

When CTRL+C (SIGTERM) is specified, TeleIRC now exits gracefully #347

Closed xforever1313 closed 4 years ago

xforever1313 commented 4 years ago

I noticed when hitting CTRL+C when TeleIRC was running, the bot didn't exit gracefully, it exited with EXITCODE 2.

This pull captures the SIGTERM signal when CTRL+C is hit (or when something sends SIGTERM to the process), and then has the program gracefully exit. First, however, it will send the IRC QUIT message if it is specified in the config.

...

I didn't add unit tests to irc.go for the new function, I'm not experienced in go to figure out how to mock a third-party library. But the function is simple enough where I'm not super concerned.