|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
867 bytes
|
| Line | |
|---|
| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | const {platform, type} = require("os");
|
|---|
| 4 |
|
|---|
| 5 | const supportedPlatforms = new Set([
|
|---|
| 6 | "aix",
|
|---|
| 7 | "android",
|
|---|
| 8 | "darwin",
|
|---|
| 9 | "freebsd",
|
|---|
| 10 | "linux",
|
|---|
| 11 | "openbsd",
|
|---|
| 12 | "sunos",
|
|---|
| 13 | "win32"
|
|---|
| 14 | ]);
|
|---|
| 15 |
|
|---|
| 16 | const plat = platform();
|
|---|
| 17 |
|
|---|
| 18 | if (supportedPlatforms.has(plat)) {
|
|---|
| 19 | let file = plat;
|
|---|
| 20 | if (plat === "aix") {
|
|---|
| 21 | file = type() === "OS400" ? "ibmi" : "sunos"; // AIX `netstat` output is compatible with Solaris
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | const m = require(`./${file}.js`);
|
|---|
| 25 | module.exports.v4 = () => m.v4();
|
|---|
| 26 | module.exports.v6 = () => m.v6();
|
|---|
| 27 | module.exports.v4.sync = () => m.v4.sync();
|
|---|
| 28 | module.exports.v6.sync = () => m.v6.sync();
|
|---|
| 29 | } else {
|
|---|
| 30 | const err = new Error(`Unsupported Platform: ${plat}`);
|
|---|
| 31 | module.exports.v4 = () => Promise.reject(err);
|
|---|
| 32 | module.exports.v6 = () => Promise.reject(err);
|
|---|
| 33 | module.exports.v4.sync = () => { throw err; };
|
|---|
| 34 | module.exports.v6.sync = () => { throw err; };
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.