fix: run sudo command only when both disable-sudo and disable-sudo-and-dockers is true

This commit is contained in:
Rohan Prabhu 2025-04-13 22:13:27 +05:30
commit b81d650d0e
No known key found for this signature in database
GPG key ID: 45E8F0204AC7E3B5

View file

@ -81,21 +81,9 @@ import { isGithubHosted } from "./tls-inspect";
}
var disable_sudo = process.env.STATE_disableSudo;
if (disable_sudo !== "true") {
try {
var journalLog = cp.execSync("sudo journalctl -u agent.service --lines=1000", {
encoding: "utf8",
maxBuffer: 1024 * 1024 * 10 // 10MB buffer
});
console.log("agent.service log:");
console.log(journalLog);
} catch (error) {
console.log("Warning: Could not fetch service logs:", error.message);
}
}
var disable_sudo_and_containers = process.env.disableSudoAndContainers;
if (disable_sudo_and_containers !== "true") {
if (disable_sudo !== "true" && disable_sudo_and_containers !== "true") {
try {
var journalLog = cp.execSync("sudo journalctl -u agent.service --lines=1000", {
encoding: "utf8",