Coder Social home page Coder Social logo

Comments (2)

sindresorhus avatar sindresorhus commented on June 22, 2024

Can we reliably just do process.binding('uv')?

Yes, but we probably shouldn't as they're trying to deprecate it: nodejs/node#2768 I think we should rather open an issue requesting a public API for what we need.

from execa.

jamestalmage avatar jamestalmage commented on June 22, 2024

they're trying to deprecate it ...

That is labeled as "stalled", and there are strong arguments for only preventing access to bindings which might be harmful (I doubt an errname lookup would count as harmful, but not sure what else the uv binding does).

I think we should rather open an issue requesting a public API for what we need

Yes, absolutely. In the meantime let's just write a defensive wrapper around process.binding('uv') so execa will only blow up if we can't access the binding, and they have a negative exit code. (it's only needed for negative exit codes). That allows us to stay backward compatible and provide the errname until a public API is available.

Assuming they deprecate before providing a public alternative, we might also be able to extract it from util._errnoException. It builds an error object from an exit code that has the errname lookup attached. That's obviously a private method, but we could just write more defensive wrappers around our access to it. That method is used liberally in the Node codebase, so no matter what, I think we will be able to hack a workable solution one way or the other until someone creates the "right way" to do it.

from execa.

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.