Update ping.js

This commit is contained in:
William Harrison authored and GitHub committed 2023-05-01 12:41:34 +08:00
1 parent e13d6f6d09
commit 85aa2b405d
1 file changed
+3 -3
+3 -3
View File
@@ -1,5 +1,5 @@
const fs = require("fs");
const { exec } = require("child_process");
const { execSync } = require("child_process");
fs.readdirSync("domains").forEach(async (file) => {
if (file.endsWith(".json")) {
@@ -11,7 +11,7 @@ fs.readdirSync("domains").forEach(async (file) => {
if (recordType === "A" || recordType === "AAAA") {
for (const val of recordValue) {
try {
await exec(`ping -c 1 ${recordValue}`);
await execSync(`ping -c 1 ${recordValue}`);
console.log(`PASS ${domain} ${recordType} ${val}`);
fs.appendFileSync("ping_results.txt", `PASS ${domain} ${recordType} ${val}\n`);
} catch {
@@ -21,7 +21,7 @@ fs.readdirSync("domains").forEach(async (file) => {
}
} else if (recordType === "CNAME") {
try {
await exec(`ping -c 1 ${recordValue}`);
await execSync(`ping -c 1 ${recordValue}`);
console.log(`PASS ${domain} ${recordType} ${recordValue}`);
fs.appendFileSync("ping_results.txt", `PASS ${domain} ${recordType} ${recordValue}\n`);
} catch {