Comparing version 0.0.17 to 0.0.18
/*! | ||
* Tmp | ||
* Copyright (c) 2011 KARASZI Istvan <github@spam.raszi.hu> | ||
* GPLv2 Licensed | ||
* | ||
* Copyright (c) 2011-2013 KARASZI Istvan <github@spam.raszi.hu> | ||
* | ||
* MIT Licensed | ||
*/ | ||
@@ -30,3 +32,6 @@ | ||
// this will hold the objects need to be removed on exit | ||
_removeObjects = []; | ||
_removeObjects = [], | ||
_gracefulCleanup = false, | ||
_uncaughtException = false; | ||
@@ -235,2 +240,6 @@ /** | ||
function _garbageCollector() { | ||
if (_uncaughtException && !_gracefulCleanup) { | ||
return; | ||
} | ||
for (var i = 0, length = _removeObjects.length; i < length; i++) { | ||
@@ -245,10 +254,10 @@ try { | ||
function _gracefulCleanup() { | ||
process.on('uncaughtException', function (err) { | ||
_garbageCollector(); | ||
throw err; | ||
}); | ||
function _setGracefulCleanup() { | ||
_gracefulCleanup = true; | ||
} | ||
// adding to the exit listener | ||
process.addListener('uncaughtException', function _uncaughtExceptionThrown() { | ||
_uncaughtException = true; | ||
}); | ||
process.addListener('exit', _garbageCollector); | ||
@@ -261,2 +270,2 @@ | ||
module.exports.tmpName = _getTmpName; | ||
module.exports.setGracefulCleanup = _gracefulCleanup; | ||
module.exports.setGracefulCleanup = _setGracefulCleanup; |
{ | ||
"name": "tmp", | ||
"version": "0.0.17", | ||
"version": "0.0.18", | ||
"description": "Temporary file and directory creator", | ||
@@ -39,4 +39,4 @@ "author": "KARASZI István <github@spam.raszi.hu> (http://raszi.hu/)", | ||
"devDependencies": { | ||
"vows": "~0.6.3" | ||
"vows": "~0.7.0" | ||
} | ||
} |
@@ -59,2 +59,5 @@ # Tmp | ||
If you want to cleanup the directory even when there are entries in it, then | ||
you can pass the `unsafeCleanup` option when creating it. | ||
### Filename generation | ||
@@ -61,0 +64,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26569
681
163