Signal
– signal handle¶
-
class
uv.
Signal
(loop=None, on_signal=None)[source]¶ Signal handles implement Unix style signal handling on a per-event loop basis. Reception of the generic
uv.Signals
is emulated on Windows. Watchers for other signals can be successfully created, but these signals are never received.Note
On Linux SIGRT0 and SIGRT1 (signals 32 and 33) are used by the NPTL pthreads library to manage threads. Installing watchers for those signals will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them.
-
on_signal
¶ Callback which should be called on signal delivery.
-
on_signal(signal_handle, signum):
Parameters:
Readonly: False Type: Callable[[uv.Signal, int], None] -
-
signum
¶ Signal currently monitored by this handle.
Raises: uv.ClosedHandleError – handle has already been closed or is closing Readonly: True Return type: int
-
start
(signum, on_signal=None)[source]¶ Start listening for the given signal.
Raises: - uv.UVError – error while starting the handle
- uv.ClosedHandleError – handle has already been closed or is closing
Parameters: - signum (int) – signal number to listen for
- on_signal (Callable[[uv.Signal, int], None]) – callback which should be called on signal delivery (overrides the current callback if specified)
-
-
class
uv.
Signals
[source]¶ Standard cross platform signals enumeration.
-
SIGINT
= None¶ Is normally delivered when the user presses CTRL+C. However it is not generated when terminal is in raw mode.
Type: uv.Signals
-
SIGBREAK
= None¶ Is delivered when the user presses CTRL+BREAK. This signal is only supported on Windows.
Type: uv.Signals
-
SIGHUP
= None¶ Is generated when the user closes the console window. After that the OS might terminate the program after a few seconds.
Type: uv.Signals
-
SIGWINCH
= None¶ Is generated when the console window has been resized. On Windows libuv emulates SIGWINCH when the program uses a
uv.TTY
handle to write to the console. It may not always be delivered in a timely manner, because libuv will only detect changes when the cursor is being moved. When a readableuv.TTY
handle is used in raw mode, resizing the console buffer will also trigger SIGWINCH.Type: uv.Signals
-