Browse Source

test: Don't run async operation in process 'exit'

Also, this seems to occasionally cause some annoying file-locking
errors in Windows.  Not sure if this is the best fix, but it seems
to make the warnings go away in that spot.
v0.10.0-release
isaacs 12 years ago
parent
commit
8cf2d4c2c1
  1. 10
      test/simple/test-http-curl-chunk-problem.js

10
test/simple/test-http-curl-chunk-problem.js

@ -31,14 +31,7 @@ var http = require('http');
var cp = require('child_process'); var cp = require('child_process');
var fs = require('fs'); var fs = require('fs');
var filename = require('path').join(common.tmpDir || '/tmp', 'big'); var filename = require('path').join(common.tmpDir, 'big');
// Clean up after ourselves. Leaving files around
// in the tmp/ directory may break tests that depend
// on a certain number of files being there.
process.on('exit', function() {
fs.unlink(filename);
});
var count = 0; var count = 0;
function maybeMakeRequest() { function maybeMakeRequest() {
@ -50,6 +43,7 @@ function maybeMakeRequest() {
var hex = stdout.match(/([A-Fa-f0-9]{40})/)[0]; var hex = stdout.match(/([A-Fa-f0-9]{40})/)[0];
assert.equal('8c206a1a87599f532ce68675536f0b1546900d7a', hex); assert.equal('8c206a1a87599f532ce68675536f0b1546900d7a', hex);
console.log('got the correct response'); console.log('got the correct response');
fs.unlink(filename);
server.close(); server.close();
}); });
} }

Loading…
Cancel
Save