diff --git a/Sources/SwiftShell/Stream/Stream.swift b/Sources/SwiftShell/Stream/Stream.swift index 52dd42b..1a315b3 100644 --- a/Sources/SwiftShell/Stream/Stream.swift +++ b/Sources/SwiftShell/Stream/Stream.swift @@ -119,8 +119,11 @@ extension ReadableStream { /// - Note: if the stream is read from outside of the handler, or more than once inside /// the handler, it may be called once when stream is closed and empty. public func onOutput(_ handler: @escaping (ReadableStream) -> Void) { - filehandle.readabilityHandler = { [unowned self] _ in - handler(self) + filehandle.readabilityHandler = { [weak self] _ in + guard let wSelf = self else { + return + } + handler(wSelf) } } diff --git a/SwiftShell.podspec b/SwiftShell.podspec index 7258637..7f5ad31 100644 --- a/SwiftShell.podspec +++ b/SwiftShell.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SwiftShell' - s.version = '4.0.0' + s.version = '4.0.1' s.summary = 'A Swift framework for shell scripting.' s.description = 'SwiftShell is a library for creating command-line applications and running shell commands in Swift.' s.homepage = 'https://github.com/kareman/SwiftShell'