%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
'use strict';
const common = require('../common');
const assert = require('assert');
const { promisify } = require('util');
const execFile = promisify(require('child_process').execFile);
// Test that --trace-sync-io works. In particular, a warning should be printed
// when it is enabled and synchronous I/O happens after the first event loop
// turn, and no warnings should occur when it is disabled or synchronous I/O
// happens before the first event loop turn is over.
if (process.argv[2] === 'late-sync-io') {
setImmediate(() => {
require('fs').statSync(__filename);
});
return;
} else if (process.argv[2] === 'early-sync-io') {
require('fs').statSync(__filename);
return;
}
(async function() {
for (const { execArgv, variant, warnings } of [
{ execArgv: ['--trace-sync-io'], variant: 'late-sync-io', warnings: 1 },
{ execArgv: [], variant: 'late-sync-io', warnings: 0 },
{ execArgv: ['--trace-sync-io'], variant: 'early-sync-io', warnings: 0 },
{ execArgv: [], variant: 'early-sync-io', warnings: 0 },
]) {
const { stdout, stderr } =
await execFile(process.execPath, [...execArgv, __filename, variant]);
assert.strictEqual(stdout, '');
const actualWarnings =
stderr.match(/WARNING: Detected use of sync API[\s\S]*statSync/g);
if (warnings === 0)
assert.strictEqual(actualWarnings, null);
else
assert.strictEqual(actualWarnings.length, warnings);
}
})().then(common.mustCall());