//// Copyright (c) 2026, Novant LLC// Licensed under the MIT License//// History:// 26 Oct 2026 Andy Frank Creation//using concurrent*************************************************************************** LineOutStream*************************************************************************** OutStream that splits written bytes into UTF-8 lines and** delivers each to a callback. Used to capture Process output.class LineOutStream : OutStream{new make(|Str| onLine) : super(null){this.onLine = onLine }** Ticks of last write, safe to read from any thread. Int lastWrite(){ lastWriteRef.val }override This write(Int b){ lastWriteRef.val = Duration.nowTicksif(b == '\n') emitelse buf.write(b)returnthis}override This writeBuf(Buf b, Int n := b.remaining){ n.times { write(b.read)}returnthis}override This flush(){this}** Deliver any trailing partial line.override Bool close(){if(buf.size > 0) emitreturntrue}private Void emit(){ line := buf.flip.readAllStr(false) buf.clearif(line.endsWith("\r")) line = line[0..-2] onLine(line)}private |Str| onLineprivate Buf buf := Buf()privateconst AtomicInt lastWriteRef := AtomicInt(Duration.nowTicks)}