Skip to content

0.4.1: a standard stream kept while it is captured; what a program used - #20

Merged
Sunrisepeak merged 3 commits into
mainfrom
release/0.4.1
Nov 8, 2026
Merged

Sunrisepeak merged 3 commits into
mainfrom
release/0.4.1

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Implements mcpp-community/mcpp design 2026-11-09 (the target model PR): mcpp's unit tests move from GoogleTest to mtest, and nine of them read what mcpp prints on its standard error, which GoogleTest's CaptureStderr gave them.

Changes

  • stdio::capture. capture::begin(stream::error) (or stream::output) makes the stream a file until text() or destruction puts it back; text() gives what was written meanwhile — through openkal, the C library and the C++ streams, and by programs started meanwhile.
  • Each system its own descriptor. Linux and macOS: the kernel's (openat/open, dup, dup2), as output_to_error does; Windows under the C runtime: _wopen and _dup2, which also sets the standard handle; Windows under openkal-musl: the C library's descriptor and the standard handle, each appending to the file; Emscripten: the C library's; an image: not_supported.
  • process::resources. of::self: this program's user and system time, largest resident set, and bytes read and written (Linux /proc/self/io, Windows GetProcessIoCounters); of::children: its waited-for children together, by getrusage (Linux and macOS). Windows children and images answer not_supported. mtest's resource monitor (design 2026-11-09 §17.5) measures a program by starting it from a process of its own.
  • Test. tests/process_test captures the error stream of a copy of itself written through openkal, the C library and a started program, then checks that the stream was put back; a copy that touches 64 MiB is accounted to its parent.

Verification

  • Linux x86_64: mcpp test process passes (the new check holds).

Co-authored-by: speak-agent [email protected]

@Sunrisepeak Sunrisepeak changed the title 0.4.1: a standard stream kept while it is captured (stdio::capture) 0.4.1: a standard stream kept while it is captured; what a program used Nov 8, 2026
@Sunrisepeak
Sunrisepeak merged commit defb432 into main Nov 8, 2026
23 checks passed
@Sunrisepeak
Sunrisepeak deleted the release/0.4.1 branch November 8, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant