Skip to content

Commit cdb9e21

Browse files
committed
Use fatalError() for no-op methods
1 parent 7b577a7 commit cdb9e21

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/Subprocess/IO/Input.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public struct NoInput: InputProtocol {
6565
/// Asynchronously write the input to the subprocess that uses the
6666
/// write file descriptor.
6767
public func write(with writer: StandardInputWriter) async throws {
68-
// noop
68+
fatalError("Unexpected call to \(#function)")
6969
}
7070

7171
internal init() {}
@@ -97,7 +97,7 @@ public struct FileDescriptorInput: InputProtocol {
9797
/// Asynchronously write the input to the subprocess that use the
9898
/// write file descriptor.
9999
public func write(with writer: StandardInputWriter) async throws {
100-
// noop
100+
fatalError("Unexpected call to \(#function)")
101101
}
102102

103103
internal init(
@@ -155,7 +155,7 @@ internal struct CustomWriteInput: InputProtocol {
155155
/// Asynchronously write the input to the subprocess using the
156156
/// write file descriptor.
157157
public func write(with writer: StandardInputWriter) async throws {
158-
// noop
158+
fatalError("Unexpected call to \(#function)")
159159
}
160160

161161
internal init() {}

Sources/Subprocess/IO/Output.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal import Dispatch
2525

2626
/// Output protocol specifies the set of methods that a type must implement to
2727
/// serve as the output target for a subprocess.
28-
28+
///
2929
/// Instead of developing custom implementations of `OutputProtocol`, use the
3030
/// default implementations provided by the `Subprocess` library to specify the
3131
/// output handling requirements.
@@ -52,7 +52,7 @@ extension OutputProtocol {
5252
/// A concrete output type for subprocesses that indicates that the
5353
/// subprocess should not collect or redirect output from the child
5454
/// process.
55-
55+
///
5656
/// On Unix-like systems, `DiscardedOutput` redirects the
5757
/// standard output of the subprocess to `/dev/null`, while on Windows,
5858
/// redirects the output to `NUL`.
@@ -79,7 +79,7 @@ public struct DiscardedOutput: OutputProtocol {
7979

8080
/// A concrete output type for subprocesses that writes output
8181
/// to a specified file descriptor.
82-
82+
///
8383
/// Developers have the option to instruct the `Subprocess` to automatically
8484
/// close the related `FileDescriptor` after the subprocess is spawned.
8585
public struct FileDescriptorOutput: OutputProtocol {
@@ -354,12 +354,12 @@ extension OutputProtocol where OutputType == Void {
354354
#if SubprocessSpan
355355
/// Convert the output from raw span to expected output type
356356
public func output(from span: RawSpan) throws {
357-
// noop
357+
fatalError("Unexpected call to \(#function)")
358358
}
359359
#endif
360360
/// Convert the output from a sequence of 8-bit unsigned integers to expected output type.
361361
public func output(from buffer: some Sequence<UInt8>) throws {
362-
// noop
362+
fatalError("Unexpected call to \(#function)")
363363
}
364364
}
365365

0 commit comments

Comments
 (0)