mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Disable signal trap for usage kemal with other tools (#642)
This commit is contained in:
parent
05d55540b9
commit
1a45f54c6c
1 changed files with 7 additions and 7 deletions
14
src/kemal.cr
14
src/kemal.cr
|
@ -7,18 +7,18 @@ require "./kemal/helpers/*"
|
|||
|
||||
module Kemal
|
||||
# Overload of `self.run` with the default startup logging.
|
||||
def self.run(port : Int32?, args = ARGV)
|
||||
self.run(port, args) { }
|
||||
def self.run(port : Int32?, args = ARGV, trap_signal : Bool = true)
|
||||
self.run(port, args, trap_signal) { }
|
||||
end
|
||||
|
||||
# Overload of `self.run` without port.
|
||||
def self.run(args = ARGV)
|
||||
self.run(nil, args: args)
|
||||
def self.run(args = ARGV, trap_signal : Bool = true)
|
||||
self.run(nil, args: args, trap_signal: trap_signal)
|
||||
end
|
||||
|
||||
# Overload of `self.run` to allow just a block.
|
||||
def self.run(args = ARGV, &block)
|
||||
self.run(nil, args: args, &block)
|
||||
self.run(nil, args: args, trap_signal: true, &block)
|
||||
end
|
||||
|
||||
# The command to run a `Kemal` application.
|
||||
|
@ -27,7 +27,7 @@ module Kemal
|
|||
#
|
||||
# To use custom command line arguments, set args to nil
|
||||
#
|
||||
def self.run(port : Int32? = nil, args = ARGV, &block)
|
||||
def self.run(port : Int32? = nil, args = ARGV, trap_signal : Bool = true, &block)
|
||||
Kemal::CLI.new args
|
||||
config = Kemal.config
|
||||
config.setup
|
||||
|
@ -36,7 +36,7 @@ module Kemal
|
|||
# Test environment doesn't need to have signal trap and logging.
|
||||
if config.env != "test"
|
||||
setup_404
|
||||
setup_trap_signal
|
||||
setup_trap_signal if trap_signal
|
||||
end
|
||||
|
||||
server = config.server ||= HTTP::Server.new(config.handlers)
|
||||
|
|
Loading…
Reference in a new issue