On Tue, 2016-03-15 at 11:32 +0000, Andrea Giammarchi wrote:
Dear all, I wonder if there's any better way than spawning command line "queries" to obtain some HW info, like those shown in GNOME Details. As example, I'm replicating node.js `os` module in here: https://github.com/WebReflection/jsgtk/blob/master/jsgtk_modules/os.j s but I couldn't find a GLib or GJS way to retrieve basic info such `uname -a` so I have to manually parse some output out of commands that are surely not portable cross platform (e.g. OSX has no `/proc/cpuinfo` or `/proc/loadavg` or `uptime -s` command )
Can you make use of a small C library? You should be able to reimplement some of that in C by calling uname and/or sysconf. Might still not be portable though, and you'll end up parsing /proc anyway on Linux. Otherwise you can try using libgtop. It's not the best library to access from introspection, and it's quite an heavy dependency to put on every program using jsgtk, but it gives you the data you need and it's portable to Linux and most BSDs. Hope this helps, Giovanni PS: I didn't know about jsgtk, but it seems a cool idea that is worth pursuing, kudos!
Thanks in advance for any sort of hint/link/idea. Best Regards _______________________________________________ javascript-list mailing list javascript-list gnome org https://mail.gnome.org/mailman/listinfo/javascript-list
Attachment:
signature.asc
Description: This is a digitally signed message part