diff options
Diffstat (limited to 'tools/util.py')
-rw-r--r-- | tools/util.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/util.py b/tools/util.py index a4355b41f..ca18faf54 100644 --- a/tools/util.py +++ b/tools/util.py @@ -5,6 +5,7 @@ import shutil import stat import sys import subprocess +import tempfile RESET = "\x1b[0m" FG_RED = "\x1b[31m" @@ -381,3 +382,10 @@ def parse_wrk_output(output): def platform(): return {"linux2": "linux", "darwin": "mac", "win32": "win"}[sys.platform] + +def mkdtemp(): + # On Windows, set the base directory that mkdtemp() uses explicitly. If not, + # it'll use the short (8.3) path to the temp dir, which triggers the error + # 'TS5009: Cannot find the common subdirectory path for the input files.' + temp_dir = os.environ["TEMP"] if os.name == 'nt' else None + return tempfile.mkdtemp(dir=temp_dir) |