diff options
Diffstat (limited to 'test/parallel/test-fs-truncate.js')
-rw-r--r-- | test/parallel/test-fs-truncate.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-fs-truncate.js b/test/parallel/test-fs-truncate.js index 95036dc9f5..044ff622bd 100644 --- a/test/parallel/test-fs-truncate.js +++ b/test/parallel/test-fs-truncate.js @@ -147,7 +147,7 @@ function testFtruncate(cb) { const file2 = path.resolve(tmp, 'truncate-file-2.txt'); fs.writeFileSync(file2, 'Hi'); const fd = fs.openSync(file2, 'r+'); - process.on('exit', () => fs.closeSync(fd)); + process.on('beforeExit', () => fs.closeSync(fd)); fs.ftruncateSync(fd, 4); assert(fs.readFileSync(file2).equals(Buffer.from('Hi\u0000\u0000'))); } @@ -165,7 +165,7 @@ function testFtruncate(cb) { const file4 = path.resolve(tmp, 'truncate-file-4.txt'); fs.writeFileSync(file4, 'Hi'); const fd = fs.openSync(file4, 'r+'); - process.on('exit', () => fs.closeSync(fd)); + process.on('beforeExit', () => fs.closeSync(fd)); fs.ftruncate(fd, 4, common.mustCall(function(err) { assert.ifError(err); assert(fs.readFileSync(file4).equals(Buffer.from('Hi\u0000\u0000'))); @@ -176,7 +176,7 @@ function testFtruncate(cb) { const file5 = path.resolve(tmp, 'truncate-file-5.txt'); fs.writeFileSync(file5, 'Hi'); const fd = fs.openSync(file5, 'r+'); - process.on('exit', () => fs.closeSync(fd)); + process.on('beforeExit', () => fs.closeSync(fd)); ['', false, null, {}, []].forEach((input) => { assert.throws( @@ -232,7 +232,7 @@ function testFtruncate(cb) { const file6 = path.resolve(tmp, 'truncate-file-6.txt'); fs.writeFileSync(file6, 'Hi'); const fd = fs.openSync(file6, 'r+'); - process.on('exit', () => fs.closeSync(fd)); + process.on('beforeExit', () => fs.closeSync(fd)); fs.ftruncate(fd, -1, common.mustCall(function(err) { assert.ifError(err); assert(fs.readFileSync(file6).equals(Buffer.from(''))); |