New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill should accept signal names, not just numbers #11

Closed
mgedmin opened this Issue Apr 15, 2015 · 6 comments

Comments

Projects
None yet
2 participants
@mgedmin
Member

mgedmin commented Apr 15, 2015

These three should be equivalent

zdaemon kill 12
zdaemon kill USR2
zdaemon kill SIGUSR2
@freddrake

This comment has been minimized.

Show comment
Hide comment
@freddrake

freddrake Apr 15, 2015

Contributor

zc.signalhandler (https://pypi.python.org/pypi/zc.signalhandler/) has code you can rip off. Not that it's hard to write, but... why bother re-inventing?

Contributor

freddrake commented Apr 15, 2015

zc.signalhandler (https://pypi.python.org/pypi/zc.signalhandler/) has code you can rip off. Not that it's hard to write, but... why bother re-inventing?

@mgedmin

This comment has been minimized.

Show comment
Hide comment
@mgedmin

mgedmin Apr 15, 2015

Member

zc.signalhandler is not on GitHub

😢

Member

mgedmin commented Apr 15, 2015

zc.signalhandler is not on GitHub

😢

@mgedmin

This comment has been minimized.

Show comment
Hide comment
@mgedmin
Member

mgedmin commented Apr 15, 2015

@mgedmin

This comment has been minimized.

Show comment
Hide comment
@mgedmin

mgedmin Apr 15, 2015

Member

Eh, name2signal from zc.signalhandler kind of does the opposite of what I need: converts signal numbers or names to names.

I can do getattr(signal, name2signal(arg)), I suppose, to convert it back into a number.

Member

mgedmin commented Apr 15, 2015

Eh, name2signal from zc.signalhandler kind of does the opposite of what I need: converts signal numbers or names to names.

I can do getattr(signal, name2signal(arg)), I suppose, to convert it back into a number.

mgedmin added a commit that referenced this issue Apr 15, 2015

Make 'kill' accept signal names (#11)
Uses name2signal() copied and pasted from zc.signalhandler.

Adds a test for the previously-untested do_kill().

@mgedmin mgedmin closed this Apr 15, 2015

@freddrake

This comment has been minimized.

Show comment
Hide comment
@freddrake

freddrake Apr 15, 2015

Contributor

Gosh, you closed this before I could respond to your comments.

Since you had to copy name2signal, you could have modified it to return the signal number instead of the normalized name. That would have avoided the awkward extra step.

Fortunately, that's still possible with another commit. :-)

Contributor

freddrake commented Apr 15, 2015

Gosh, you closed this before I could respond to your comments.

Since you had to copy name2signal, you could have modified it to return the signal number instead of the normalized name. That would have avoided the awkward extra step.

Fortunately, that's still possible with another commit. :-)

@mgedmin

This comment has been minimized.

Show comment
Hide comment
@mgedmin

mgedmin Apr 15, 2015

Member

Instead I decided to grab the opportunity to change the output to print the name of the signal being sent, instead of the number.

(Hm, there's already another number-to-name conversion function in zdrun.py. Perhaps something could be refactored there. I won't object ;-)

Member

mgedmin commented Apr 15, 2015

Instead I decided to grab the opportunity to change the output to print the name of the signal being sent, instead of the number.

(Hm, there's already another number-to-name conversion function in zdrun.py. Perhaps something could be refactored there. I won't object ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment