async-signals 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 969ede7a2ae47c0fe9599becb2508e5c967fae6f9794724441b0c26bb206d94c
4
- data.tar.gz: 7498cf8e1e038d238655cfb86d942990d41fa1bd8defde3e31d746c05b7229b1
3
+ metadata.gz: 8f6e3d24ea8368c2e4dff801e3dc6d284a5e668bf494cfd8c896012832229356
4
+ data.tar.gz: 40f7897eb02e1fd4e5fb8647bac3e5534ed5ae764aafd0a47b946d04015b5fa4
5
5
  SHA512:
6
- metadata.gz: 5fa34ee6b5d702e0da640a56654f57c1dee5e3d6190ed37d9d78d5d3ea249d7acba78c5d7ad3c01c7e08cd882ab49b08e4dcbba0bf5e9914218c6fd954df6574
7
- data.tar.gz: 9861c7a96dbbd194ccf2243599e77e66bf50b949ce593d0f4b369da238d7e0b6b69aaebbabd25979b2e8187af2a66e692312618f86635ae747d588767bcc8f6e
6
+ metadata.gz: 27ea87c8781794e16d00e2f9c2b4b0329fcd647355be0b798a949a2d80aedf7ee2a94c3c2b7346543b1885a03e808b1412a04410d5ddfd7f4d82938218980876
7
+ data.tar.gz: dc8f749f9206d40a2244c0fa22821dee0b2122497db18a83d0d865316bd9b0fd89c147c55120379162a3f0d479c0b4528ff14ffb7cc2ce21938126114f0d43a4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2026, by Samuel Williams.
5
+
6
+ module Async
7
+ module Signals
8
+ # Installs default signal handlers for graceful shutdown.
9
+ #
10
+ # Ruby's built-in handling for `SIGINT` can bypass `Thread.handle_interrupt`, which makes graceful shutdown unreliable for event loops and other code that needs to defer interruption while cleaning up. This file also maps `SIGTERM` to `Interrupt`, so both termination signals follow the same graceful shutdown path when they are still using Ruby's default handler.
11
+ #
12
+ # See <https://bugs.ruby-lang.org/issues/22133> for more details.
13
+ module Graceful
14
+ SIGNALS = ["INT", "TERM"].freeze
15
+
16
+ SIGNALS.each do |signal|
17
+ previous = ::Signal.trap(signal) do
18
+ ::Thread.main.raise(::Interrupt)
19
+ end
20
+
21
+ unless previous == "DEFAULT"
22
+ ::Signal.trap(signal, previous)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -7,6 +7,6 @@
7
7
  module Async
8
8
  # @namespace
9
9
  module Signals
10
- VERSION = "0.5.0"
10
+ VERSION = "0.6.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -24,6 +24,10 @@ Please see the [project documentation](https://socketry.github.io/async-signals/
24
24
 
25
25
  Please see the [project releases](https://socketry.github.io/async-signals/releases/index) for all releases.
26
26
 
27
+ ### v0.6.0
28
+
29
+ - Add `async/signals/graceful` for installing default `SIGINT` and `SIGTERM` handlers that raise `Interrupt`.
30
+
27
31
  ### v0.5.0
28
32
 
29
33
  - Change `Async::Signals.default` to select process signal handling only on the main thread when no fiber scheduler is installed.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.6.0
4
+
5
+ - Add `async/signals/graceful` for installing default `SIGINT` and `SIGTERM` handlers that raise `Interrupt`.
6
+
3
7
  ## v0.5.0
4
8
 
5
9
  - Change `Async::Signals.default` to select process signal handling only on the main thread when no fiber scheduler is installed.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-signals
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -49,6 +49,7 @@ files:
49
49
  - lib/async/signals.rb
50
50
  - lib/async/signals/context.rb
51
51
  - lib/async/signals/controller.rb
52
+ - lib/async/signals/graceful.rb
52
53
  - lib/async/signals/handlers.rb
53
54
  - lib/async/signals/ignore.rb
54
55
  - lib/async/signals/version.rb
metadata.gz.sig CHANGED
Binary file