Skip to content

Allow limiting stdout/err capture #344

Description

@bitprophet

Description

This is Invoke's version of fabric/fabric#800. tl;dr allow limiting the stdout/err captured, for users who a) experience severe mismatches between the size of their subprocess' output streams and their system's available memory; and b) don't need to examine that output in whole afterwards.

Unlike the notes at the bottom of that ticket, where we're using Fabric 1's RingBuffer, here in Invoke land we can just use collections.deque(xxx, maxlen=yyy).

Also, because we have a somewhat richer (and publicly documented) Result class, we can (and should) add a flag to Result noting when the ring buffer is being limited, so users have at least a little warning when shooting themselves in the foot ("hey, I turned on this memory saving feature I saw on StackOverflow, but now I only see the last 1024 bytes of stdout!")

Specific TODO

  • Replace the list objects used for capture buffers, with deque objects
  • Add the usual config/kwarg structures for a new e.g. capture_buffer_size (or similarly named) option
  • Make use of that in setting maxlen for the deque
  • Probably emit a warning of some kind if it's being set to a too-small value (i.e. one insufficient to handle any keys in the prompt configuration).
    • Maybe even just raise an exception - having a non-empty prompt config implies expectation of a specific functionality, which the user has just probably-accidentally broken...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions