Skip to content

Commit 74cc92b

Browse files
committed
Explicitly handle HUP.
1 parent 06078f5 commit 74cc92b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/async/container/controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ def run
201201
raise Terminate
202202
end
203203

204+
hangup_action = Signal.trap(:HUP) do
205+
raise Hangup
206+
end
207+
204208
self.start
205209

206210
while @container&.running?
@@ -228,6 +232,7 @@ def run
228232
# Restore the interrupt handler:
229233
Signal.trap(:INT, interrupt_action)
230234
Signal.trap(:TERM, terminate_action)
235+
Signal.trap(:HUP, hangup_action)
231236
end
232237
end
233238
end

lib/async/container/error.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def initialize
3636
end
3737
end
3838

39+
class Hangup < SignalException
40+
SIGHUP = Signal.list['HUP']
41+
42+
def initialize
43+
super(SIGHUP)
44+
end
45+
end
46+
3947
# Represents the error which occured when a container failed to start up correctly.
4048
class SetupError < Error
4149
def initialize(container)

0 commit comments

Comments
 (0)