remove sudo requirement when launching on the CLI under Linux systems (#425)

* Update MemoryUtil.hx

* move comment

* Remove random whitespace

* I kinda broke mac there
This commit is contained in:
crowplexus
2024-11-03 02:14:21 +01:00
committed by GitHub
parent 02612239e8
commit da3fd5e0dd
+4 -2
View File
@@ -130,14 +130,16 @@ class MemoryUtil {
reg.match(process.stdout.readAll().toString()); reg.match(process.stdout.readAll().toString());
if (process.exitCode() == 0) return reg.matched(1); if (process.exitCode() == 0) return reg.matched(1);
#elseif linux #elseif linux
var process = new HiddenProcess("sudo", ["dmidecode", "--type", "17"]); /*var process = new HiddenProcess("sudo", ["dmidecode", "--type", "17"]);
if (process.exitCode() != 0) return "Unknown"; if (process.exitCode() != 0) return "Unknown";
var lines = process.stdout.readAll().toString().split("\n"); var lines = process.stdout.readAll().toString().split("\n");
for (line in lines) { for (line in lines) {
if (line.indexOf("Type:") == 0) { if (line.indexOf("Type:") == 0) {
return line.substring("Type:".length).trim(); return line.substring("Type:".length).trim();
} }
} }*/
// TODO: sort of unsafe? also requires users to use `sudo`
// when launching the engine through the CLI, REIMPLEMENT LATER.
#end #end
return "Unknown"; return "Unknown";
} }