➜

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.

作者 giampaolo.rodola
收信人 giampaolo.rodola
日期 2016-02-12.14:01:42
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1455285703.05.0.44078516142.issue26350@psf.upfronthosting.co.za>
In-reply-to
内容
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?
历史
日期 用户 动作 参数
2016-02-12 14:01:43giampaolo.rodola修改recipients: + giampaolo.rodola
2016-02-12 14:01:43giampaolo.rodola修改messageid: <1455285703.05.0.44078516142.issue26350@psf.upfronthosting.co.za>
2016-02-12 14:01:43giampaolo.rodola链接issue26350 messages
2016-02-12 14:01:42giampaolo.rodola创建