UNPKG

@nexssp/os

Version:

Get linux distro name, distro version, package managers, check isRoot, convert paths.. + now install things easy for all OSes!

28 lines (25 loc) 580 B
exports.cmd = (command, { all, dry }) => { if (!dry) { const shell = require('../legacy').getShell() return (what) => { try { const result = require('child_process') .execSync(`${command} ${what}`, { shell, }) .toString() .trim() // we return all found if (all) { return result } return result.split(/\r?\n/)[0] } catch (error) { // console.log(error) return false } } } else { return (what) => `${command} ${what}` } }