-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
30 lines (25 loc) · 908 Bytes
/
test.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
/*!
* linux-release-info test
*
* Licensed under MIT
* Copyright (c) 2018-2020 [Samuel Carreira]
*/
console.time('benchmark'); // benchmark startup
const {releaseInfo} = require('./dist/index');
const path = require('path');
console.log('Linux Release Info Test\n');
try {
const infoSyncData = releaseInfo({ mode: 'sync' });
console.log(`Sync mode test:\n\tYou are using ${infoSyncData.pretty_name} on a ${infoSyncData.arch} machine`); // Distro name and arch info
} catch (err) {
console.error(`Error reading OS release info: ${err}`);
}
// async test
releaseInfo({
custom_file: path.resolve(__dirname, 'os_release_sample'),
debug: true
}).then(result => {
console.log(`Custom file and async mode test:\n\tYou are using ${result.pretty_name} on a ${result.arch} machine`);
console.timeEnd('benchmark');
})
.catch(err => console.error(`Error reading OS release info: ${err}`));