Skip to content

[Bug] taskLog does not correctly handle carriage-return spinner/progress output #510

@colinaaa

Description

@colinaaa

Environment

  • OS: All
  • Node Version: v24.14.1
  • Package: @clack/prompts
  • Package Version: v1.2.0

Describe the bug

taskLog does not correctly handle carriage-return (\r) updates from spinner/progress-style output.
When a tool writes multiple updates to the same terminal line using carriage returns, taskLog does not model those updates as in-place overwrites. As a result, intermediate frames can accumulate in the internal log state and the rendered output/clearing behavior can become inconsistent on completion, especially around error() and showLog.
This seems related to taskLog being a raw prompt with its own rendering logic instead of using the shared rendering path used by other prompts.

To Reproduce

Steps to reproduce the behavior:

  • Create a taskLog instance from @clack/prompts
  • Stream spinner-like updates with carriage returns, for example:
    import * as prompts from '@clack/prompts';
    const log = prompts.taskLog({
    	title: 'foo',
    });
    log.message('◒  Cloning repository', { raw: true });
    log.message('\r◐  Cloning repository', { raw: true });
    log.message('\r◓  Cloning repository', { raw: true });

Expected behavior

taskLog should treat carriage-return updates as overwrites of the current visible line.
That means:

  • only the latest spinner/progress frame should be retained
  • intermediate frames should not accumulate in the log
  • error() / success() rendering should reflect the final visible state
  • clearing behavior should match the number of actually rendered lines

Additional Information

See: #509 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions