Skip to content

Add support for SIGQUIT #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Sources/UnixSignals/UnixSignal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public struct UnixSignal: Hashable, Sendable, CustomStringConvertible {
case sigusr1
case sigusr2
case sigalrm
case sigquit
}

private let wrapped: Wrapped
Expand All @@ -49,6 +50,8 @@ public struct UnixSignal: Hashable, Sendable, CustomStringConvertible {
public static let sighup = Self(.sighup)
/// Issued if the user sends an interrupt signal.
public static let sigint = Self(.sigint)
/// Issued if the user sends a quit signal.
public static let sigquit = Self(.sigquit)
/// Software termination signal.
public static let sigterm = Self(.sigterm)
public static let sigusr1 = Self(.sigusr1)
Expand All @@ -66,6 +69,8 @@ extension UnixSignal.Wrapped: CustomStringConvertible {
return "SIGHUP"
case .sigint:
return "SIGINT"
case .sigquit:
return "SIGQUIT"
case .sigterm:
return "SIGTERM"
case .sigusr1:
Expand All @@ -85,6 +90,8 @@ extension UnixSignal.Wrapped {
return SIGHUP
case .sigint:
return SIGINT
case .sigquit:
return SIGQUIT
case .sigterm:
return SIGTERM
case .sigusr1:
Expand Down
2 changes: 2 additions & 0 deletions Tests/UnixSignalsTests/UnixSignalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ final class UnixSignalTests: XCTestCase {

assert(.sigalrm, rawValue: SIGALRM)
assert(.sigint, rawValue: SIGINT)
assert(.sigquit, rawValue: SIGQUIT)
assert(.sighup, rawValue: SIGHUP)
assert(.sigusr1, rawValue: SIGUSR1)
assert(.sigusr2, rawValue: SIGUSR2)
Expand All @@ -127,6 +128,7 @@ final class UnixSignalTests: XCTestCase {

assert(.sigalrm, description: "SIGALRM")
assert(.sigint, description: "SIGINT")
assert(.sigquit, description: "SIGQUIT")
assert(.sighup, description: "SIGHUP")
assert(.sigusr1, description: "SIGUSR1")
assert(.sigusr2, description: "SIGUSR2")
Expand Down