Skip to content

Add incremental output getters to API\Process\Service\OutputCallbackInterface? #358

Description

@TravisCarden

API\Process\Service\OutputCallbackInterface::getOutput() and ::getErrorOutput() are cumulative. In other words, if you pass a callback into one process run it and then pass it into another process and call that, the callback will contain the output from both processes. This can lead to unexpected results, including making functions that should be idempotent non-idempotent. That can be avoided by called ::clearOutput() and ::clearErrorOutput() between runs, but that may not be obvious and it's easy to forget anyway.

Maybe we should follow the example of Symfony Process, which also provides ::getIncrementalOutput() and ::getIncrementalErrorOutput(). In that case, it might be wise to rename ::getOutput() (and ::getErrorOutput(), accordingly) to ::getAllOutput() or ::getCumulitiveOutput() in order to force a user to make an explicit choice of behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions