File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -394,8 +394,13 @@ private extension Process {
394394
395395 waitUntilExit ( )
396396
397- outputHandle? . closeFile ( )
398- errorHandle? . closeFile ( )
397+ if let handle = outputHandle, !handle. isStandard {
398+ handle. closeFile ( )
399+ }
400+
401+ if let handle = errorHandle, !handle. isStandard {
402+ handle. closeFile ( )
403+ }
399404
400405 #if !os(Linux)
401406 outputPipe. fileHandleForReading. readabilityHandler = nil
@@ -418,6 +423,14 @@ private extension Process {
418423 }
419424}
420425
426+ private extension FileHandle {
427+ var isStandard : Bool {
428+ return self === FileHandle . standardOutput ||
429+ self === FileHandle . standardError ||
430+ self === FileHandle . standardInput
431+ }
432+ }
433+
421434private extension Data {
422435 func shellOutput( ) -> String {
423436 guard let output = String ( data: self , encoding: . utf8) else {
You can’t perform that action at this time.
0 commit comments