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 {
394
394
395
395
waitUntilExit ( )
396
396
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
+ }
399
404
400
405
#if !os(Linux)
401
406
outputPipe. fileHandleForReading. readabilityHandler = nil
@@ -418,6 +423,14 @@ private extension Process {
418
423
}
419
424
}
420
425
426
+ private extension FileHandle {
427
+ var isStandard : Bool {
428
+ return self === FileHandle . standardOutput ||
429
+ self === FileHandle . standardError ||
430
+ self === FileHandle . standardInput
431
+ }
432
+ }
433
+
421
434
private extension Data {
422
435
func shellOutput( ) -> String {
423
436
guard let output = String ( data: self , encoding: . utf8) else {
You can’t perform that action at this time.
0 commit comments