Making the CLI usable #1034
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-02#1034
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm working on a new, better version of the CLI here. There are some issues I've bumped into and I can't fix them without changes in Bitmessage itself.
The one BIG issue I'm having is regardless of the signal I send to bitmessagemain ( SIGTERM or SIGKILL ) within the CLI, it doesn't close. So, trying to figure out why that's the case..
There may be other issues as well, but these are the big pieces I've found.
doCleanShutdown should be fixed, you're right
I'm still not convinced to get rid of os.fork, but I'll change it for windows as that's not implemented and other people also reported it
I'll review the os.exit, that seems a reasonable request, however in some cases I think it's preferable (when you run out of disk space, for example).
Do you understand as to why os.fork was put in to begin with? The docs ( https://docs.python.org/2/library/os.html ) state:
which means that we're not getting a clean shutdown like sys.exit ( https://docs.python.org/2/library/sys.html#sys.exit )
That then makes us need to address the /need/ ( or lack there of ) for os.fork.
Regarding os.exit, if you run out of disk space and/or there are errors with disk reading/writing, and this triggers cleanup procedures, these may also fail for the same reason. That is why in such a case I'd prefer a hard exit, but that's basically the only exception.
Regarding daemonizing, that isn't merely to satisfy the system tools, it also has security benefits, such as closing filehandles, changing permissions, releasing memory and so on. Systemd or upstart can handle programs that don't daemonize, but some people may prefer more traditional tools like the BSD init, which is easier to do with a traditional daemon. Now, it's true that there needs to be an additional check for Windows. Moreover the code was broken in 0.6.2 (but that should be fixed now). But that isn't such a big deal, I just checked and on windows, os.fork() throws an AttributeError, so I'll just wrap an exception handler around it. If that still isn't enough, I can add a config option to make fork optional.
I haven't tried it, so if you're still having problems, let me know.
Still having problems. SIGTERM does nothing for bitmessagemain, but works for every other program I use subprocess' Popen, and SIGTERM on.
Looks to be working on Linux now, can you test for Windows/Mac/BSD?
Added:
Catching signals through setSignalHandler that uses helper_generic BREAKS the ability to use .terminate() in subprocess
Why exactly are signals being caught anyway? Surely there's a better way to approach this...