File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,20 @@ struct MarkdownCommand: ParsableCommand {
3030 ] )
3131
3232 static func parseFile( at path: String , options: ParseOptions ) throws -> ( source: String , parsed: Document ) {
33- let data = try Data ( contentsOf: URL ( fileURLWithPath: path) )
33+ let data = try Data ( contentsOf: URL ( fileURLWithPath: path) )
3434 guard let inputString = String ( data: data, encoding: . utf8) else {
3535 throw Error . couldntDecodeInputAsUTF8
3636 }
3737 return ( inputString, Document ( parsing: inputString, options: options) )
3838 }
3939
4040 static func parseStandardInput( options: ParseOptions ) throws -> ( source: String , parsed: Document ) {
41- let stdinData = FileHandle . standardInput. readDataToEndOfFile ( )
41+ let stdinData : Data
42+ if #available( macOS 10 . 15 . 4 , * ) {
43+ stdinData = try FileHandle . standardInput. readToEnd ( ) ?? Data ( )
44+ } else {
45+ stdinData = FileHandle . standardInput. readDataToEndOfFile ( )
46+ }
4247 guard let stdinString = String ( data: stdinData, encoding: . utf8) else {
4348 throw Error . couldntDecodeInputAsUTF8
4449 }
You can’t perform that action at this time.
0 commit comments