From 462a43cd53569efe3fabfac664b902aaa39b0b43 Mon Sep 17 00:00:00 2001 From: ray-1337 <33544674+ray-1337@users.noreply.github.com> Date: Fri, 29 Jul 2022 00:52:18 +0200 Subject: [PATCH] optimized checkPlatformExact checking --- src/Util.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Util.js b/src/Util.js index d0536fe..1fac861 100644 --- a/src/Util.js +++ b/src/Util.js @@ -71,7 +71,8 @@ module.exports.checkPlatformExact = function () { // return true; try { - return execSync("cat /etc/*release | grep -E ^NAME")?.toString("utf-8").split('=').pop().replace(/(")/gi, "").toLowerCase() == "ubuntu" ? true : false; + const check = execSync("cat /etc/*release | grep -E ^NAME"); + return check?.toString("utf-8").match("Ubuntu") ? true : false; } catch (e) { console.error(e); return false;