-
Notifications
You must be signed in to change notification settings - Fork 8
/
detect-linux.js
37 lines (31 loc) · 1.05 KB
/
detect-linux.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var exec = require('child_process').exec;
module.exports = function (callback) {
var command = 'xdg-mime query default x-scheme-handler/http';
exec(command, function (err, stdout, stderr) {
if(err) {
callback('Unable to execute the query: ' + err + '\n' + stderr);
return;
}
var value = stdout;
/*
* ubuntu 14.04.1:
* --------
* firefox.desktop
* google-chrome.desktop
* chromium-browser.desktop
* opera.desktop
*/
var out = {
isIE: false,
isSafari: false,
isFirefox: value.indexOf('firefox') > -1,
isChrome: value.indexOf('google') > -1,
isChromium: value.indexOf('chromium') > -1,
isOpera: value.indexOf('opera') > -1,
identity: value
};
out.isWebkit = out.isBlink = (out.isChrome || out.isChromium || out.isOpera);
out.commonName = require('./common-name')(out);
callback(null, out);
});
};