diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-11 10:39:31 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-11 10:42:18 +0300 |
commit | 69c67542e76bcbc37563399eb3ab8716c6a37774 (patch) | |
tree | 39c5891a02caacb4b7bcd0a4a5b0ba099d1b86ba /tools/shared.py | |
parent | 5351b86b0768813c4c18bb61494c43b07bc00372 (diff) |
Remove the unwanted abstraction that callee is allowed to autodelete a response file after consuming it. Instead, manually track and delete response files by the caller and clean them up.
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/shared.py b/tools/shared.py index 7692b4f8..dce27a18 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -39,8 +39,8 @@ class WindowsPopen: # emscripten.py supports reading args from a response file instead of cmdline. # Use .rsp to avoid cmdline length limitations on Windows. if len(args) >= 2 and args[1].endswith("emscripten.py"): - response_filename = create_response_file(args[2:], TEMP_DIR) - args = args[0:2] + [response_filename] + self.response_filename = create_response_file(args[2:], TEMP_DIR) + args = args[0:2] + ['@' + self.response_filename] try: # Call the process with fixed streams. @@ -75,6 +75,13 @@ class WindowsPopen: def kill(self): return self.process.kill() + + def __del__(self): + try: + # Clean up the temporary response file that was used to spawn this process, so that we don't leave temp files around. + tempfiles.try_delete(self.response_filename) + except: + pass # Mute all exceptions in dtor, particularly if we didn't use a response file, self.response_filename doesn't exist. # Install our replacement Popen handler if we are running on Windows to avoid python spawn process function. if os.name == 'nt': |