Skip to content

Windows: make stderr and outputBytes assertions robust to locale and CRLF #4

@tsavo-at-pieces

Description

@tsavo-at-pieces

Problem

Two Windows failures are caused by platform-native output differences:

  1. sub_process_test.dart: an error while spawning is printed to stderr
  2. sub_process_test.dart: outputBytes returns the script's output as bytes

Reproduction

Root cause

  • Spawn error text is OS/locale-dependent (and can differ in punctuation).
  • print() output bytes are platform-native (\r\n on Windows vs \n on Unix).

Expected behavior

Tests should remain strict enough to validate behavior without requiring locale-specific exact strings or Unix-only line endings.

Proposed approach

  1. Replace exact ProcessException string match with robust matcher (e.g. startsWith('ProcessException:') + stable prefix checks).
  2. Make output bytes expectation platform-aware (Platform.lineTerminator) or normalize line endings in test assertions.
  3. Add a short contract note in docs/comments that outputBytes returns raw platform-native bytes.

Acceptance criteria

  • Both tests pass on windows-x64 and windows-arm64
  • Both tests remain meaningful and green on Linux/macOS
  • No weakening of failure signal (tests still verify correct behavior)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions