Skip to content

Commit 7bef63b

Browse files
authored
Add support for SIGPIPE (#214)
This PR adds `SIGPIPE` to the `UnixSignals`
1 parent 83cecce commit 7bef63b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Sources/UnixSignals/UnixSignal.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public struct UnixSignal: Hashable, Sendable, CustomStringConvertible {
4040
case sigquit
4141
case sigwinch
4242
case sigcont
43+
case sigpipe
4344
}
4445

4546
private let wrapped: Wrapped
@@ -75,6 +76,8 @@ public struct UnixSignal: Hashable, Sendable, CustomStringConvertible {
7576
/// Signal when the window is resized.
7677
public static let sigwinch = Self(.sigwinch)
7778
public static let sigcont = Self(.sigcont)
79+
/// Signal when a write is performed on a closed fd
80+
public static let sigpipe = Self(.sigpipe)
7881
}
7982

8083
extension UnixSignal.Wrapped: Hashable {}
@@ -107,6 +110,8 @@ extension UnixSignal.Wrapped: CustomStringConvertible {
107110
return "SIGWINCH"
108111
case .sigcont:
109112
return "SIGCONT"
113+
case .sigpipe:
114+
return "SIGPIPE"
110115
}
111116
}
112117
}
@@ -138,6 +143,8 @@ extension UnixSignal.Wrapped {
138143
return SIGWINCH
139144
case .sigcont:
140145
return SIGCONT
146+
case .sigpipe:
147+
return SIGPIPE
141148
}
142149
}
143150
}

0 commit comments

Comments
 (0)