libcompose icon indicating copy to clipboard operation
libcompose copied to clipboard

Default listener is writing directly to stdout

Open F21 opened this issue 10 years ago • 3 comments

In https://github.com/docker/libcompose/blob/master/project/listener.go#L71, the default listener writes directly to stdout (tested on windows and ubuntu).

I am writing a cli app that uses libcompose to talk with the docker daemon and the output from the listener pollutes the output of my cli app.

Is it possible to redirect the output of the listener into memory so that I can write the output of the listener to stdout on my terms?

F21 avatar Mar 03 '16 05:03 F21

Hi @F21, thanks for the report. It's on its way, there is some refactoring to come in this area :stuck_out_tongue_closed_eyes:.

vdemeester avatar Mar 03 '16 07:03 vdemeester

@vdemeester Is there anyway I can help get the ball rolling on this one? Maybe the adding a Listener field to the context struct passed to NewProject(). If there is a listener passed in, it uses it, otherwise it creates a DefaultListener. Let me know what you think!

F21 avatar Mar 19 '16 09:03 F21

I just notice NewDefaultListener() requires an instance of project, which causes a chicken and egg problem.

F21 avatar Mar 20 '16 08:03 F21