Skip to content

exec streaming does not seem to work #262

Closed
@Intrepidd

Description

@Intrepidd

Hi guys,

I'm starting to hack around with this gem and I'm having an issue with streaming the output of a command.

I'd have thought the block passed to the exec command would be called each time some output is available.

Here's the command I'm using :

container.exec(['/bin/bash', '-c', 'ls && sleep 2 && ls && sleep 2 && ls'], chunk_size: 1) { |stream, chunk| puts chunk.size; $stdout.flush  }

The block is effectively called 3 times, outputting the following :

85
85
85

That's great, however it seems that all blocks are executed when the command stops, and not every second for 3 second as I would have liked :

85
* 1 second sleep*
85
* 1 second sleep*
85

Is this normal behavior ? Is there a gotcha I missed ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions