Skip to content

Commit a16c814

Browse files
authored
Fix #81 - prevent mangling multi-byte UTF8 chars split across data events (#82)
1 parent 681e6a8 commit a16c814

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

bin/Main.purs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,11 @@ resolveRcForDir root = go List.Nil
366366

367367
readStdin :: Aff String
368368
readStdin = makeAff \k -> do
369-
contents <- Ref.new ""
369+
contents <- Ref.new []
370370
Stream.onData Process.stdin \buff -> do
371-
chunk <- Buffer.toString UTF8 buff
372-
void $ Ref.modify (_ <> chunk) contents
371+
void $ Ref.modify (_ `Array.snoc` buff) contents
373372
Stream.onEnd Process.stdin do
374-
k <<< Right =<< Ref.read contents
373+
k <<< Right =<< Buffer.toString UTF8 =<< Buffer.concat =<< Ref.read contents
375374
pure mempty
376375

377376
generateOperatorsCommand :: Array String -> Aff Unit

0 commit comments

Comments
 (0)