A single Console IO type obscures direction and syscall descriptors.
Flow and algorithm
Platform spec article
Flow and algorithm
Spec standingStandard
-
stdin/stdout/stderr use separate System modules.
Context
Decision
Rule Detail Modules System.Input,System.Output,System.ErrorForbidden Monolithic console IO type for standard streams Consequences
Each module binds one
StandardStreamdescriptor; cross-stream APIs stay separate.Verification anchors
packages/runtime/src/System/Input.bd,Output.bd,Error.bd. -
Syscall write failures panic; reads surface Result.
Context
v1 write helpers are infallible at the type level; read paths need explicit error handling.
Decision
Rule Detail Write Write/WriteLinemust panic onWriteWithfailureRead Read/ReadLinereturnResult<string, SyscallError>Consequences
Diagnostics for write failures use fixed panic strings; callers cannot catch write errors in Beskid v1.
Verification anchors
Corelib stream tests; syscall integration in
beskid_runtime. -
WriteLine appends a single LF byte sequence.
Context
Cross-platform hosts may translate line endings below the Beskid API.
Decision
Rule Detail Ending WriteLinemust append\nonlyWindows Host/platform layer may translate later without API change Consequences
Authors see consistent Beskid source semantics; CRLF is not encoded in corelib strings.
Verification anchors
Output.bd/Error.bdtests; platform IO docs.
- Contracts and edge cases MUST rules for standard stream reads, writes, and error handling.
- Design model Stream module boundaries and syscall descriptor model for standard I/O.
- Examples Standard stream read and write usage patterns.
- Flow and algorithm Read and write algorithms for standard stream helpers.
- Verification and traceability Runtime syscall and corelib anchors for standard stream I/O.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
Purpose
Section titled “Purpose”Document flow and algorithm for the Console Io Streams feature: role-specific normative detail beyond the feature hub.
Canonical references
Section titled “Canonical references”- Feature hub: Console Io Streams
- Sibling articles in this bundle (design model, contracts, flow, examples, verification)
Detailed behavior
Section titled “Detailed behavior”Write path
Section titled “Write path”- Caller supplies a Beskid
string(UTF-8). - Module builds
WriteRequestwithDescriptor::Standard(Stdout | Stderr)and payload bytes. Syscall.WriteWithinvokes__syscall_write.- On
Result::Error, module panics with the stable panic string (IO-004).
WriteLine chains two writes; callers should not embed \n in text when using WriteLine unless a double newline is intended.
Read path (ReadLine)
Section titled “Read path (ReadLine)”- Loop
ReadWithon stdin with a byte limit until:- buffer contains
\n→ return slice before newline, or - EOF / error → return
Resultper syscall mapping.
- buffer contains
- No ANSI parsing occurs; escape bytes in stdin are returned literally to the caller.
Console tick integration
Section titled “Console tick integration”Console.RunTick polls resize and may write control sequences via System.Output after formatting. The tick loop should run on a fiber that owns the terminal UI; see Console terminal events.
Styled output flow
Section titled “Styled output flow”Markup or Ansi builders → gated string → System.Output.Write / WriteLine. Capability probing runs before write, not inside Output.bd.
Verification
Section titled “Verification”See the verification and traceability article in this bundle and compiler/corelib/beskid_corelib/tests/corelib_tests/src/console/.
Related topics
Section titled “Related topics”- Parent feature hub and Terminal and console area