Skip to content

Add support for SIGWINCH #161

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
Oct 10, 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 @@ -31,6 +31,7 @@ public struct UnixSignal: Hashable, Sendable, CustomStringConvertible {
case sigusr2
case sigalrm
case sigquit
case sigwinch
}

private let wrapped: Wrapped
Expand All @@ -57,6 +58,8 @@ public struct UnixSignal: Hashable, Sendable, CustomStringConvertible {
public static let sigusr1 = Self(.sigusr1)
public static let sigusr2 = Self(.sigusr2)
public static let sigalrm = Self(.sigalrm)
/// Signal when the window is resized.
public static let sigwinch = Self(.sigwinch)
}

extension UnixSignal.Wrapped: Hashable {}
Expand All @@ -79,6 +82,8 @@ extension UnixSignal.Wrapped: CustomStringConvertible {
return "SIGUSR2"
case .sigalrm:
return "SIGALRM"
case .sigwinch:
return "SIGWINCH"
}
}
}
Expand All @@ -100,6 +105,8 @@ extension UnixSignal.Wrapped {
return SIGUSR2
case .sigalrm:
return SIGALRM
case .sigwinch:
return SIGWINCH
}
}
}
1 change: 1 addition & 0 deletions Tests/UnixSignalsTests/UnixSignalTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ final class UnixSignalTests: XCTestCase {
assert(.sigusr1, description: "SIGUSR1")
assert(.sigusr2, description: "SIGUSR2")
assert(.sigterm, description: "SIGTERM")
assert(.sigwinch, description: "SIGWINCH")
}

func testCancelledTask() async throws {
Expand Down