Code Monkey home page Code Monkey logo

Comments (12)

saghul avatar saghul commented on May 18, 2024

The information shown is actually part of the actual test suite, since we test the output of some functions. There are currently no uv functions to provide OS information, do you have something in mind? I have a vague recolection of someone also asking for this long time ago.

As for the format, I'd stick to good old plaintext :-)

from libuv.

jbergstroem avatar jbergstroem commented on May 18, 2024

I didn't really consider including functionality for os information in libuv, rather just fiddling with uname/similar output. If you/they paste full configure output some parts show up, but that's just hard to read.

from libuv.

saghul avatar saghul commented on May 18, 2024

Well, that's autoconf at work... We'd need something cross platform, and parsing uname really isn't.

from libuv.

jbergstroem avatar jbergstroem commented on May 18, 2024

If we rely on autoconf we could "parse" its output (config.log)?

from libuv.

saghul avatar saghul commented on May 18, 2024

We don't rely on autoconf. That's one of the build systems, we also have GYP and on Windows / MinGW there is a dedicated Makefile.

from libuv.

sztomi avatar sztomi commented on May 18, 2024

@saghul, is this something you would still add to libuv? If so, I would take look.

from libuv.

saghul avatar saghul commented on May 18, 2024

I'm open to suggestions :-)

from libuv.

sztomi avatar sztomi commented on May 18, 2024

@saghul, I'm thinking something along the lines of uv_cpu_info_t, but for OS information.

typedef enum { android, aix, win, unix, darwin } uv_sys_kind_t;

typedef struct uv_kernel_version_s {
  int major;
  int minor;
  int patch;
  int build;
  char* extra_string;
} uv_kernel_version_t;

typedef struct uv_os_info {
  uv_sys_kind_t sys;
  char* sysname_string; /* "Windows", "Android" etc. */
  char* release_string; /* "Vista", "XP", "trusty" etc.*/
  uv_kernel_version_t kernel_version; /* structure to allow testing the versions numerically */
} uv_os_info_t;

/* Retrieve OS information */
int uv_os_info(uv_os_info_t*);

/* Pretty print OS information */
int uv_strosinfo(char*, uv_os_info_t*);

(just as a quick sketch, I need to familiarize myself with the project more, but you get the idea)

It might make sense to return the kernel version in a struct. As for the implementation, GetVersion&friends on Windows, uname on posix-friendly systems, plus trying to read /etc/lsb-release or issue etc. files. (I think it would be nice if the implementation detected the distributions on *nix).

Is this something like what you had in mind?

from libuv.

saghul avatar saghul commented on May 18, 2024

@sztomi thios is good work, thanks! I'll need a few days to work through the mail pile, but this is a good start IMHO.

from libuv.

zhaozg avatar zhaozg commented on May 18, 2024

Need this feature thanks

from libuv.

sztomi avatar sztomi commented on May 18, 2024

@saghul cool, then I'll try to whip out an initial implementation on my fork and let you know here when I have something to show.

from libuv.

saghul avatar saghul commented on May 18, 2024

No follow-up, closing. Feel free to open a PR when ready.

from libuv.

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.