Reputation: 452
How can I get linux release version? For example, when my code run on a CentOS linux, i could get 'CentOS', if Ubuntu get 'Ubuntu'. I have seen the os module node it self, but can not find any api of this.
Upvotes: 1
Views: 709
Reputation: 476
It seems that nothing in the OS module exists to identify the linux distribution. You can get it this way:
exec('cat /etc/*release | grep -E ^NAME', function(error, stdout, stderr) {
//stdout contains NAME="CentOS Linux", NAME=Fedora depending, ...
//parse the string to get what you want
});
Source: http://www.novell.com/coolsolutions/feature/11251.html
Upvotes: 2