File tree Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -434,13 +434,8 @@ private extension Process {
434
434
435
435
waitUntilExit ( )
436
436
437
- if let handle = outputHandle, !handle. isStandard {
438
- handle. closeFile ( )
439
- }
440
-
441
- if let handle = errorHandle, !handle. isStandard {
442
- handle. closeFile ( )
443
- }
437
+ outputHandle? . closeFile ( )
438
+ errorHandle? . closeFile ( )
444
439
445
440
outputPipe. fileHandleForReading. readabilityHandler = nil
446
441
errorPipe. fileHandleForReading. readabilityHandler = nil
@@ -461,23 +456,12 @@ private extension Process {
461
456
}
462
457
}
463
458
464
- private extension FileHandle {
465
- var isStandard : Bool {
466
- return self === FileHandle . standardOutput ||
467
- self === FileHandle . standardError ||
468
- self === FileHandle . standardInput
469
- }
470
- }
471
-
472
459
private extension Data {
473
460
func shellOutput( ) -> String {
474
- guard let output = String ( data: self , encoding: . utf8) else {
475
- return " "
476
- }
461
+ let output = String ( decoding: self , as: UTF8 . self)
477
462
478
463
guard !output. hasSuffix ( " \n " ) else {
479
- let endIndex = output. index ( before: output. endIndex)
480
- return String ( output [ ..< endIndex] )
464
+ return String ( output. dropLast ( ) )
481
465
}
482
466
483
467
return output
You can’t perform that action at this time.
0 commit comments