hyf

Context-aware query service for Radroots
git clone https://radroots.dev/git/hyf.git
Log | Files | Refs | README | LICENSE

stdio_stderr_flood_entrypoint.mojo (604B)


      1 """Test-only stdio entrypoint that floods stdout and stderr interleaved.
      2 
      3 Exercises LC04: the parent must drain stdout and stderr concurrently with
      4 writing the request instead of deadlocking on a full pipe, and must bound the
      5 diagnostics it retains with a distinct overflow cause.
      6 """
      7 
      8 from std.sys import stderr
      9 
     10 
     11 def main():
     12     var out_chunk = String("")
     13     for _ in range(1000):
     14         out_chunk += "o"
     15     var err_chunk = String("")
     16     for _ in range(1000):
     17         err_chunk += "e"
     18     for _ in range(100):
     19         print(out_chunk)
     20         print(err_chunk, file=stderr)
     21     print('{"ok":true}')