mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
1b97774c44
Emits 'stop' event for fs.watchFile on process.nextTick to fix 'maximum call stack size exceeded' error when `stop` is called synchronously after listener is attached. PR-URL: https://github.com/nodejs/node/pull/8524 Fixes: https://github.com/nodejs/node/issues/8421 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yorkie Liu <yorkiefixer@gmail.com>
10 lines
261 B
JavaScript
10 lines
261 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
|
|
const watch = fs.watchFile(__filename, () => {});
|
|
watch.once('stop', assert.fail); // Should not trigger.
|
|
watch.stop();
|
|
watch.removeListener('stop', assert.fail);
|