Skip to content

Commit b8be370

Browse files
committed
Add try catch block
1 parent 6f6fa07 commit b8be370

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

Diff for: dist/post/index.js

+11-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/post/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/cleanup.ts

+10-6
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,16 @@ import { isGithubHosted } from "./tls-inspect";
8282

8383
var disable_sudo = process.env.STATE_disableSudo;
8484
if (disable_sudo !== "true") {
85-
var journalLog = cp.execSync("sudo journalctl -u agent.service --lines=1000", {
86-
encoding: "utf8",
87-
maxBuffer: 1024 * 1024 * 10 // 10MB buffer
88-
});
89-
console.log("Service log:");
90-
console.log(journalLog);
85+
try {
86+
var journalLog = cp.execSync("sudo journalctl -u agent.service --lines=1000", {
87+
encoding: "utf8",
88+
maxBuffer: 1024 * 1024 * 10 // 10MB buffer
89+
});
90+
console.log("Service log:");
91+
console.log(journalLog);
92+
} catch (error) {
93+
console.log("Warning: Could not fetch service logs:", error.message);
94+
}
9195
}
9296

9397
try {

0 commit comments

Comments
 (0)