mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-30 04:11:57 +00:00
feat: Effects that shouldn't be needed removed from utils
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Effects } from "../../types"
|
||||
import { createUtils } from "../../util"
|
||||
import { stringFromStdErrOut } from "../../util/stringFromStdErrOut"
|
||||
import { CheckResult } from "./CheckResult"
|
||||
export function containsAddress(x: string, port: number) {
|
||||
const readPorts = x
|
||||
@@ -32,10 +33,17 @@ export async function checkPortListening(
|
||||
Promise.resolve().then(async () => {
|
||||
const hasAddress =
|
||||
containsAddress(
|
||||
await utils.runCommand(`cat /proc/net/tcp`, {}),
|
||||
await utils.childProcess
|
||||
.exec(`cat /proc/net/tcp`, {})
|
||||
.then(stringFromStdErrOut),
|
||||
port,
|
||||
) ||
|
||||
containsAddress(await utils.runCommand("cat /proc/net/udp", {}), port)
|
||||
containsAddress(
|
||||
await utils.childProcess
|
||||
.exec("cat /proc/net/udp", {})
|
||||
.then(stringFromStdErrOut),
|
||||
port,
|
||||
)
|
||||
if (hasAddress) {
|
||||
return { status: "passing", message: options.successMessage }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CommandType, Effects } from "../../types"
|
||||
import { createUtils } from "../../util"
|
||||
import { stringFromStdErrOut } from "../../util/stringFromStdErrOut"
|
||||
import { CheckResult } from "./CheckResult"
|
||||
import { timeoutPromise } from "./index"
|
||||
|
||||
@@ -22,7 +23,7 @@ export const runHealthScript = async (
|
||||
): Promise<CheckResult> => {
|
||||
const utils = createUtils(effects)
|
||||
const res = await Promise.race([
|
||||
utils.runCommand(runCommand, { timeout }),
|
||||
utils.childProcess.exec(runCommand, { timeout }).then(stringFromStdErrOut),
|
||||
timeoutPromise(timeout),
|
||||
]).catch((e) => {
|
||||
console.warn(errorMessage)
|
||||
|
||||
Reference in New Issue
Block a user