UNPKG

@codetoz/dns

Version:
37 lines (36 loc) 820 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isAdmin = void 0; const child_process_1 = require("child_process"); // const testFltmc = async () => { // try { // exec('fltmc') // return true // } catch { // return false // } // } // export const isAdmin = async () => { // if (platform() !== 'win32') { // return false // } // try { // exec(`fsutil dirty query ${env.systemdrive}`) // return true // } catch (error) { // if (error.code === 'ENOENT') { // return testFltmc() // } // return false // } // } const isAdmin = () => { try { (0, child_process_1.execFileSync)('net', ['session'], { stdio: 'ignore' }); return true; } catch (e) { return false; } }; exports.isAdmin = isAdmin;