���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /home/real/node-v13.0.1/test/parallel/ |
'use strict'; const common = require('../common'); // This test checks that Worker has correct exit codes on parent side // in multiple situations. const assert = require('assert'); const worker = require('worker_threads'); const { Worker, parentPort } = worker; const testCases = require('../fixtures/process-exit-code-cases'); // Do not use isMainThread so that this test itself can be run inside a Worker. if (!process.env.HAS_STARTED_WORKER) { process.env.HAS_STARTED_WORKER = 1; parent(); } else { if (!parentPort) { console.error('Parent port must not be null'); process.exit(100); return; } parentPort.once('message', (msg) => testCases[msg].func()); } function parent() { const test = (arg, name = 'worker', exit, error = null) => { const w = new Worker(__filename); w.on('exit', common.mustCall((code) => { assert.strictEqual( code, exit, `wrong exit for ${arg}-${name}\nexpected:${exit} but got:${code}`); console.log(`ok - ${arg} exited with ${exit}`); })); if (error) { w.on('error', common.mustCall((err) => { console.log(err); assert(error.test(err), `wrong error for ${arg}\nexpected:${error} but got:${err}`); })); } w.postMessage(arg); }; testCases.forEach((tc, i) => test(i, tc.func.name, tc.result, tc.error)); }