MCPcopy Create free account
hub / github.com/BernardoGiordano/Checkpoint / ckpt_console_stdout

Function ckpt_console_stdout

common/script/scriptconsole.cpp:365–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365FILE* ckpt_console_stdout(void)
366{
367 // Created once and never closed: picoc reinitialises per run, but the
368 // stream is stateless and shared. Unbuffered so each printf reaches the
369 // pane on the frame it happens, not whenever a 4 KB buffer fills.
370 static FILE* stream = nullptr;
371 if (stream == nullptr) {
372 stream = funopen(nullptr, nullptr, consoleStreamWrite, nullptr, nullptr);
373 if (stream != nullptr) {
374 setvbuf(stream, nullptr, _IONBF, 0);
375 }
376 }
377 // A failed funopen degrades to the real stdout: output goes nowhere
378 // visible (as before this change), but nothing crashes.
379 return stream != nullptr ? stream : stdout;
380}
381}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected