Git Product home page Git Product logo

Comments (7)

memsharded avatar memsharded commented on August 19, 2024

Hi @huysentr

Not sure what is the issue with conan install --format=json > mygraph.json.
All the application messages in Conan 2 is directed to stderr, so they don't interfere with stdout and the above works fine.

from conan.

huysentr avatar huysentr commented on August 19, 2024

I'm working in someone elses python code, and I can only modify the command, but not redirect its output. If this is the only way I will have to modify the library, no problem, it might just interfere with the approval of my PR.

from conan.

memsharded avatar memsharded commented on August 19, 2024

But Conan recipes are the thing running others code, via self.run(), see https://docs.conan.io/2/reference/conanfile/running_and_output.html#running-commands.

The self.run() already by default sends the output to stderr, so this shouldn't be a problem either. Conan 2 even redirects the print() default to stderr.

In theory it shouldn't be necessary to modify others code.

from conan.

huysentr avatar huysentr commented on August 19, 2024

I'm not sure I'm following.
The code I'm working on has an API to run a command, inside that the library of that API I see process= subprocess.Popen( cmd, stdout = None, stderr = None) I can pass the cmd to this API, but not modify those things, I'm passing a conan install command. (I can modify those things ofc, but that's a different step)

from conan.

memsharded avatar memsharded commented on August 19, 2024

Ok, I think I understand now, thanks for the explanations.

So there is a Python dependency (from pip install package or something similar, I guess?) and that library is internally doing a Popen without redirecting the streams.

Yes, I am afraid this is something that would need some provision inside that Python library code. The usual approach when some Python code is managing subprocess is to use some configurable redirection/pipe or passing stream handlers, so the library can operate without polluting the caller standard streams (for example if the caller wants for some reason to silently execute that functionality). Conan operates on the assumption that it is possible to redirect the output of the subprocesses that it is launching, directly or indirectly within recipes.

If the code is doing stdout = None, stderr = None then it seems there is little to do, so it would be necessary to adapt that code.

from conan.

memsharded avatar memsharded commented on August 19, 2024

Hi @huysentr

Did you manage to get it working updating the library? Any further question?
Thanks for the feedback.

from conan.

memsharded avatar memsharded commented on August 19, 2024

Closing as resolved, feel free to re-open or create new tickets as necessary, thanks for the feedback.

from conan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.