leamas / ddupdate

Update DNS Data for Dynamic IP Addresses
MIT License
40 stars 28 forks source link

handle KeyboardInterrupt 's #68

Closed atesin closed 1 year ago

atesin commented 1 year ago

if i run some ddupdate command (ddupdate, ddupdate-config, etc) and i regret and press ctrl-c, it prints confuse stack traces, dirtying the console... maybe the pythonic way to exit programs, but not so user fiendly or unix'ish

leamas commented 1 year ago

Well... you probably mean keyboard interrupts, right ;)

It is certainly possible to trap the signal. However, doing so would confuse a large number of users out there which are used to how python works. Also, since running ddupdate interactively is more or less a debug or configuration tool it makes sense to provide as much information as possible. After all, using ctrl-C is certainly not a normal use case.

So I tend to think that this issue should be closed as NOT-A-BUG.

atesin commented 1 year ago

i agree with you many users are used to see those stacktrace python messages, but i think the least users that install ddupdate are python developers... most are normal linux users, along with administrators, dba's, etc, that install ddupdate mostly for practical reasons and focus on another tasks, and don't understand too much those messages and mostly confuses them

like me for example... i am not a python developer, but a sysadmin that have a home server for personal projects (web apps, arduino, download movies, etc :) )

certainly stack trace could be useful for developers, you could reserve it for development purposes (with -l debugoption for example)

leamas commented 1 year ago

This is actually a property of all python scripts, and there are many of them on a modern Linux system. If this should be filed at all, it should thus be filed against the python project.

That said, patches are welcome, but I will not spend any time on this. I'm leaning to close, either as NOT-A-BUG or WONTFIX

atesin commented 1 year ago

i had done this in a python tutorial i did... let me search...

# main loop
try:
  # do whatever
except KeyboardInterrupt:
  # ctrl-c pressed, deal with it, exit loop, etc

but maybe will be better to previously check for -l debug and as other laguages do, register a handler function with keyboardinterrupt exception/event, and if not leave is as is?? ... however i don't know how to do it... maybe with threads

EDIT: look at this = https://docs.python.org/3/library/signal.html#signal.SIGINT

leamas commented 1 year ago

Obviously, you have some problems approaching this project. Basically, you don't understand how the tools work, and this makes it hard for you to participate. I have been in this situation many times, and it leaves you with two options: learn the tools, or just skip the project. Filing overall issues like "I need better documentation" is just not fruitful. In open-source contexts the answer you get is "Indeed, why don't you write it?"

If you actually want to participate you need to acquire some basic skills. From the perspective here, I note:

There is always a need for better docs, examples and what not. However, there are already ten users actively participating, so it cannot be that bad for a niche project like this.

atesin commented 1 year ago

i am updated my system and been hitted against a wall when i wanted to organize my ddns scripts and domains ... i used to use ddclient, but now looking this project, the new kid on the block, it makes look ddclient a little outdated

certainly if i didn't felt the need for update my system (personal, not for customers... for customers we use rhel) everything would still working ok, until sometime things will break

i have not so much spare time now, sorry... i also had to travel for family issues... but when i finish to update my system (i already upgraded to fedora 36 yesterday, but found worst ddupdate problems) then i will investigate more deeply and hopefully sent you some patches, remember i am not a developer so i will try to learn and do my best