Skip to content

Logger: use fputs for stderr to fix output ordering and a closed-fd crash #390

Description

@tylervick

3.0 moved Logger.error and Logger.warning to stderr via FileHandle.standardError.write. Two small problems with that choice:

  1. Ordering. print writes to a block-buffered stdout when output is piped; FileHandle.write is unbuffered. Under 2>&1 — i.e. any CI log — warnings now appear before the "Report successfully created" line rather than interleaved where they belong.
  2. Crash on a closed descriptor. FileHandle.write raises an uncatchable Objective-C exception, so xchtmlreport … 2>&- now crashes where it previously failed silently.

Task: use fputs(message + "\n", stderr) instead, which fixes both. Optionally fflush(stdout) before writing to stderr to keep interleaving exact.

Good first issue — a couple of lines in Logger.swift.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions