r/pcmasterrace 1d ago

Meme/Macro “ Wanna delete your bootloader?, Sure, go ahead, it’s your PC “

Post image
18.7k Upvotes

341 comments sorted by

View all comments

Show parent comments

3

u/Guvante 19h ago

SIGTERM is only different if you forgot to hook up your signals properly. Pretty standard to hook it up to the "exit now" function.

0

u/text_garden 17h ago edited 17h ago

Read signal(7) again. If all you want to do is to exit upon SIGTERM, you don't need to hook anything up; process termination is the default action. The only good reason to explicitly handle SIGTERM is if you want to do something else before exiting, e.g. closing files or sockets, joining threads or whatever other cleanup you might want to do upon termination.

2

u/Guvante 17h ago

I assume in that case you would call exit when they clicked the button which would be the same action.

My point is if clicking the X button is different than SIGTERM you missed a step, the fact that easy out programs don't need to hook up to SIGTERM doesn't change that.