Skip to content

Commit

Permalink
!fixup test: fix test-beforeexit-event
Browse files Browse the repository at this point in the history
Trying to use a net server here is not reasonable, instead try with a
file.
  • Loading branch information
Fishrock123 committed Oct 9, 2015
1 parent c358723 commit 5d7262c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/parallel/test-beforeexit-event.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
var assert = require('assert');
var net = require('net');
var fs = require('fs');
var util = require('util');
var common = require('../common');
var revivals = 0;
Expand All @@ -23,18 +23,18 @@ function tryTimer() {
setTimeout(function() {
console.log('timeout cb, do another once beforeExit');
revivals++;
process.once('beforeExit', tryListen);
process.once('beforeExit', tryFile);
}, 1);
}

function tryListen() {
console.log('create a server');
net.createServer()
.listen(common.PORT)
.on('listening', function() {
revivals++;
this.close();
});
function tryFile() {
console.log('open a file');
fs.open(__filename, 'r', (err, fd) => {
if (err) throw err;

revivals++;
fs.closeSync(fd);
});
}

process.on('exit', function() {
Expand Down

0 comments on commit 5d7262c

Please sign in to comment.