mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 03:50:47 -04:00
Return failure status when playlist checks are offline (#49872)
* fix: fail playlist tests when offline * test: move offline playlist check into test suite
This commit is contained in:
@@ -58,6 +58,7 @@ const rootStorage = new Storage(ROOT_DIR)
|
||||
async function main() {
|
||||
if (await isOffline()) {
|
||||
logger.error(chalk.red('Internet connection is required for the script to work'))
|
||||
process.exitCode = 1
|
||||
return
|
||||
}
|
||||
|
||||
@@ -195,13 +196,10 @@ async function onFinish(error: Error | null | undefined) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
async function isOffline() {
|
||||
return new Promise((resolve, reject) => {
|
||||
dns.lookup('info.cern.ch', err => {
|
||||
if (err) resolve(true)
|
||||
reject(false)
|
||||
})
|
||||
}).catch(() => {})
|
||||
async function isOffline(): Promise<boolean> {
|
||||
return new Promise(resolve => {
|
||||
dns.lookup('info.cern.ch', err => resolve(Boolean(err)))
|
||||
})
|
||||
}
|
||||
|
||||
function getColor(stream: Stream): string {
|
||||
|
||||
Reference in New Issue
Block a user