blob: 33936d2d491f8b19e98b1ce016fca66315e73ddf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Flags: --expose-internals
'use strict';
// Verify that AbortSignal integration works for fs.watch
const common = require('../common');
if (common.isIBMi)
common.skip('IBMi does not support `fs.watch()`');
const fs = require('fs');
const fixtures = require('../common/fixtures');
{
// Signal aborted after creating the watcher
const file = fixtures.path('empty.js');
const ac = new AbortController();
const { signal } = ac;
const watcher = fs.watch(file, { signal });
watcher.once('close', common.mustCall());
setImmediate(() => ac.abort());
}
{
// Signal aborted before creating the watcher
const file = fixtures.path('empty.js');
const signal = AbortSignal.abort();
const watcher = fs.watch(file, { signal });
watcher.once('close', common.mustCall());
}
|