This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author giampaolo.rodola
Recipients giampaolo.rodola
Date 2016-02-12.14:01:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455285703.05.0.44078516142.issue26350@psf.upfronthosting.co.za>
In-reply-to
Content
I'm not sure whether this is a bug with signal.signal doc or with the function itself, anyway, here goes. On UNIX I'm able to register a signal handler for SIGTERM which is executed when the signal is received. On Windows I'm able to register it but it will never be executed:


import os, signal

def foo(*args):
    print("foo")  # this never gets printed on Windows

signal.signal(signal.SIGTERM, foo)
os.kill(os.getpid(), signal.SIGTERM)


I think signal module doc should be more clear about this. In details, if it is possible to execute a function on SIGTERM if should explain how. If not (and AFAIK it's not possible) it should state that "signal.signal(signal.SIGTERM, foo)" on Windows is a NOOP.

Note: I'm probably missing something but the same thing applies for SIGINT and possibly (all) other signals, so I'm not sure why Windows has signal.signal in the first place. What's its use case on Windows?
History
Date User Action Args
2016-02-12 14:01:43giampaolo.rodolasetrecipients: + giampaolo.rodola
2016-02-12 14:01:43giampaolo.rodolasetmessageid: <1455285703.05.0.44078516142.issue26350@psf.upfronthosting.co.za>
2016-02-12 14:01:43giampaolo.rodolalinkissue26350 messages
2016-02-12 14:01:42giampaolo.rodolacreate