���� 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/ |
// Flags: --expose-internals 'use strict'; // This verifies the error thrown by fs.watch. const common = require('../common'); const assert = require('assert'); const fs = require('fs'); const tmpdir = require('../common/tmpdir'); const path = require('path'); const nonexistentFile = path.join(tmpdir.path, 'non-existent'); const { internalBinding } = require('internal/test/binding'); const { UV_ENODEV, UV_ENOENT } = internalBinding('uv'); tmpdir.refresh(); { const validateError = (err) => { assert.strictEqual(err.path, nonexistentFile); assert.strictEqual(err.filename, nonexistentFile); assert.strictEqual(err.syscall, 'watch'); if (err.code === 'ENOENT') { assert.strictEqual( err.message, `ENOENT: no such file or directory, watch '${nonexistentFile}'`); assert.strictEqual(err.errno, UV_ENOENT); assert.strictEqual(err.code, 'ENOENT'); } else { // AIX assert.strictEqual( err.message, `ENODEV: no such device, watch '${nonexistentFile}'`); assert.strictEqual(err.errno, UV_ENODEV); assert.strictEqual(err.code, 'ENODEV'); } return true; }; assert.throws( () => fs.watch(nonexistentFile, common.mustNotCall()), validateError ); } { const file = path.join(tmpdir.path, 'file-to-watch'); fs.writeFileSync(file, 'test'); const watcher = fs.watch(file, common.mustNotCall()); const validateError = (err) => { assert.strictEqual(err.path, nonexistentFile); assert.strictEqual(err.filename, nonexistentFile); assert.strictEqual( err.message, `ENOENT: no such file or directory, watch '${nonexistentFile}'`); assert.strictEqual(err.errno, UV_ENOENT); assert.strictEqual(err.code, 'ENOENT'); assert.strictEqual(err.syscall, 'watch'); fs.unlinkSync(file); return true; }; watcher.on('error', common.mustCall(validateError)); // Simulate the invocation from the binding watcher._handle.onchange(UV_ENOENT, 'ENOENT', nonexistentFile); }