summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2011-07-05 01:06:39 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2011-07-05 01:13:57 +0200
commit092fc42fbf53b5884a44cdc39091603e9863431a (patch)
tree3e90c0c6362ad1fcf22a5a0101a431364c180346
parent24a671a8aa93447bc7c32286e01a6885ade491ee (diff)
downloadnodejs-092fc42fbf53b5884a44cdc39091603e9863431a.tar.gz
nodejs-092fc42fbf53b5884a44cdc39091603e9863431a.tar.bz2
nodejs-092fc42fbf53b5884a44cdc39091603e9863431a.zip
Clean up temporary file on exit.
Unbreaks test/simple/test-http-get-pipeline-problem.js, it assumed a fixed number of files in the tmp directory.
-rw-r--r--test/simple/test-http-curl-chunk-problem.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/test/simple/test-http-curl-chunk-problem.js b/test/simple/test-http-curl-chunk-problem.js
index 794b320ba..409c769de 100644
--- a/test/simple/test-http-curl-chunk-problem.js
+++ b/test/simple/test-http-curl-chunk-problem.js
@@ -27,12 +27,19 @@ if (!process.versions.openssl) {
// http://groups.google.com/group/nodejs/browse_thread/thread/f66cd3c960406919
var common = require('../common');
var assert = require('assert');
-var http = require('http'),
- cp = require('child_process');
-
+var http = require('http');
+var cp = require('child_process');
+var fs = require('fs');
var filename = require('path').join(common.tmpDir || '/tmp', '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;
function maybeMakeRequest() {
if (++count < 2) return;