Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ try {
const pkg = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'))
pkgVersion = pkg.version ?? pkgVersion
pkgName = pkg.name ?? pkgName
} catch { }
} catch {}

const HOST = envStr('API_HOST') ?? (typeof cliArgs.host === 'string' ? cliArgs.host : '127.0.0.1')
const PORT = Number(cliArgs.port) || envInt('API_PORT', 3010)
Expand Down Expand Up @@ -422,7 +422,7 @@ const requestHandler = async (req, res) => {
const force = Boolean(body.force)
try {
const stopping = pm.stop({ force })
stopping.catch(() => { })
stopping.catch(() => {})
return sendJson(res, 202, { stopping: true, force })
} catch (err) {
if (err.code === 'NOT_RUNNING') return sendJson(res, 409, { error: err.message, code: err.code })
Expand Down Expand Up @@ -554,14 +554,14 @@ function listDiagnostics() {
let error = null
try {
files = fs.readdirSync(full)
} catch { }
} catch {}
try {
createdAt = fs.statSync(full).mtime.toISOString()
} catch { }
} catch {}
if (files.includes('error.txt')) {
try {
error = fs.readFileSync(path.join(full, 'error.txt'), 'utf8').slice(0, 2000)
} catch { }
} catch {}
}
return {
name: d.name,
Expand Down