mirror of
https://github.com/whyour/qinglong.git
synced 2026-11-08 04:42:33 +08:00
29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
// execFile errors contain the command (including credentials), stdout and
|
|
// stderr. Keep CI diagnostics useful without publishing any of those values.
|
|
function processFailure(error, runtime = process) {
|
|
const stderr = String(error?.stderr || '');
|
|
return {
|
|
code: Number.isInteger(error?.code) ? error.code : null,
|
|
signal: /^SIG[A-Z0-9]+$/.test(error?.signal || '') ? error.signal : null,
|
|
killed: error?.killed === true,
|
|
node: runtime.versions.node,
|
|
arch: runtime.arch,
|
|
fatal: {
|
|
threadCreation:
|
|
/uv_thread_create|pthread_create|Failed to start thread|failed to create[^\n]*thread/i.test(
|
|
stderr,
|
|
),
|
|
outOfMemory: /heap out of memory|Allocation failed|OutOfMemory/i.test(
|
|
stderr,
|
|
),
|
|
v8Check: /Check failed:|Fatal error in/i.test(stderr),
|
|
heapBroker: /JSHeapBroker|compiler\/heap-refs/.test(stderr),
|
|
compiler: /v8::internal::(?:compiler|maglev)|PersistentHandles/.test(
|
|
stderr,
|
|
),
|
|
},
|
|
};
|
|
}
|
|
|
|
module.exports = { processFailure };
|