Skip to content

Commit

Permalink
Fix Async child process output issue (#4231)
Browse files Browse the repository at this point in the history
  • Loading branch information
louislam authored Dec 13, 2023
1 parent 4185ec2 commit 8151ac0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion server/monitor-types/tailscale-ping.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class TailscalePing extends MonitorType {
async runTailscalePing(hostname, interval) {
let timeout = interval * 1000 * 0.8;
let res = await childProcessAsync.spawn("tailscale", [ "ping", "--c", "1", hostname ], {
timeout: timeout
timeout: timeout,
encoding: "utf8",
});
if (res.stderr && res.stderr.toString()) {
throw new Error(`Error in output: ${res.stderr.toString()}`);
Expand Down
4 changes: 3 additions & 1 deletion server/notification-providers/apprise.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class Apprise extends NotificationProvider {
args.push("-t");
args.push(notification.title);
}
const s = await childProcessAsync.spawn("apprise", args);
const s = await childProcessAsync.spawn("apprise", args, {
encoding: "utf8",
});

const output = (s.stdout) ? s.stdout.toString() : "ERROR: maybe apprise not found";

Expand Down

0 comments on commit 8151ac0

Please sign in to comment.