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 {
434434
435435 waitUntilExit ( )
436436
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 ( )
444439
445440 outputPipe. fileHandleForReading. readabilityHandler = nil
446441 errorPipe. fileHandleForReading. readabilityHandler = nil
@@ -461,23 +456,12 @@ private extension Process {
461456 }
462457}
463458
464- private extension FileHandle {
465- var isStandard : Bool {
466- return self === FileHandle . standardOutput ||
467- self === FileHandle . standardError ||
468- self === FileHandle . standardInput
469- }
470- }
471-
472459private extension Data {
473460 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)
477462
478463 guard !output. hasSuffix ( " \n " ) else {
479- let endIndex = output. index ( before: output. endIndex)
480- return String ( output [ ..< endIndex] )
464+ return String ( output. dropLast ( ) )
481465 }
482466
483467 return output
You can’t perform that action at this time.
0 commit comments