don't remove the file under cygwin.

Thanks to @pombredanne for the report. fix #407
This commit is contained in:
benoitc 2013-01-06 08:23:36 +01:00
parent 84d9f4c604
commit 8ab090aafb

View File

@ -4,10 +4,16 @@
# See the NOTICE for more information.
import os
import platform
import tempfile
from gunicorn import util
PLATFORM = platform.system()
if PLATFORM.startswith('CYGWIN'):
IS_CYGWIN = True
else:
IS_CYGWIN = False
class WorkerTmp(object):
@ -21,7 +27,8 @@ class WorkerTmp(object):
# unlink the file so we don't leak tempory files
try:
util.unlink(name)
if not IS_CYGWIN:
util.unlink(name)
self._tmp = os.fdopen(fd, 'w+b', 1)
except:
os.close(fd)