forked from mirrors/amnezia-wg-easy
wip
This commit is contained in:
parent
d8f45476da
commit
650128cacb
3 changed files with 22 additions and 9 deletions
|
@ -1,5 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
const { rejects } = require('assert');
|
||||
const childProcess = require('child_process');
|
||||
const { resolve } = require('path');
|
||||
|
||||
module.exports = class Util {
|
||||
|
||||
static requireSession(req, res, next) {
|
||||
|
@ -43,4 +47,17 @@ module.exports = class Util {
|
|||
};
|
||||
}
|
||||
|
||||
static async exec(cmd) {
|
||||
if (process.platform !== 'linux') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
childProcess.exec(cmd, (err, stdout) => {
|
||||
if (err) return reject(err);
|
||||
return resolve(stdout);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue