diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-02-01 18:29:00 -0500 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-02-02 17:48:43 -0500 |
commit | 18b815e33627865b8f4d13f29e2e6e4dc7670f1d (patch) | |
tree | 7ee1b9af60fa161ef4356ae28ecf7e2c94a5cb0e /tools/util.py | |
parent | f84da880bb5bd8fadd7c884ecfeb48aa5b7b9c08 (diff) |
Support --fmt
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) |