Skip to content

Commit

Permalink
Add try catch block
Browse files Browse the repository at this point in the history
  • Loading branch information
varunsh-coder committed Jan 19, 2025
1 parent 6f6fa07 commit b8be370
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
17 changes: 11 additions & 6 deletions dist/post/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions src/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,16 @@ import { isGithubHosted } from "./tls-inspect";

var disable_sudo = process.env.STATE_disableSudo;
if (disable_sudo !== "true") {
var journalLog = cp.execSync("sudo journalctl -u agent.service --lines=1000", {
encoding: "utf8",
maxBuffer: 1024 * 1024 * 10 // 10MB buffer
});
console.log("Service log:");
console.log(journalLog);
try {
var journalLog = cp.execSync("sudo journalctl -u agent.service --lines=1000", {
encoding: "utf8",
maxBuffer: 1024 * 1024 * 10 // 10MB buffer
});
console.log("Service log:");
console.log(journalLog);
} catch (error) {
console.log("Warning: Could not fetch service logs:", error.message);
}
}

try {
Expand Down

0 comments on commit b8be370

Please sign in to comment.