We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0303aba commit ea42514Copy full SHA for ea42514
test/parallel/test-worker-fs-stat-watcher.js
@@ -0,0 +1,18 @@
1
+// Flags: --experimental-worker
2
+'use strict';
3
+const common = require('../common');
4
+const { Worker, parentPort } = require('worker_threads');
5
+const fs = require('fs');
6
+
7
+// Checks that terminating Workers does not crash the process if fs.watchFile()
8
+// has active handles.
9
10
+// Do not use isMainThread so that this test itself can be run inside a Worker.
11
+if (!process.env.HAS_STARTED_WORKER) {
12
+ process.env.HAS_STARTED_WORKER = 1;
13
+ const worker = new Worker(__filename);
14
+ worker.on('message', common.mustCall(() => worker.terminate()));
15
+} else {
16
+ fs.watchFile(__filename, () => {});
17
+ parentPort.postMessage('running');
18
+}
0 commit comments