From 8ab090aafb7c148429cf46e28a81cbdb7a0eff81 Mon Sep 17 00:00:00 2001 From: benoitc Date: Sun, 6 Jan 2013 08:23:36 +0100 Subject: [PATCH] don't remove the file under cygwin. Thanks to @pombredanne for the report. fix #407 --- gunicorn/workers/workertmp.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gunicorn/workers/workertmp.py b/gunicorn/workers/workertmp.py index fd9ef948..9815c9ce 100644 --- a/gunicorn/workers/workertmp.py +++ b/gunicorn/workers/workertmp.py @@ -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)