|
33 | 33 |
|
34 | 34 |
|
35 | 35 | DEBUG = int(os.environ.get('EMCC_DEBUG', '0'))
|
| 36 | +DEBUG_SAVE = DEBUG or int(os.environ.get('EMCC_DEBUG_SAVE', '0')) |
36 | 37 | EXPECTED_NODE_VERSION = (4, 1, 1)
|
37 | 38 | EXPECTED_BINARYEN_VERSION = 99
|
38 | 39 | EXPECTED_LLVM_VERSION = "13.0"
|
@@ -376,12 +377,14 @@ def get_emscripten_temp_dir():
|
376 | 377 | if not EMSCRIPTEN_TEMP_DIR:
|
377 | 378 | EMSCRIPTEN_TEMP_DIR = tempfile.mkdtemp(prefix='emscripten_temp_', dir=configuration.TEMP_DIR)
|
378 | 379 |
|
379 |
| - def prepare_to_clean_temp(d): |
380 |
| - def clean_temp(): |
381 |
| - try_delete(d) |
| 380 | + if not DEBUG_SAVE: |
| 381 | + def prepare_to_clean_temp(d): |
| 382 | + def clean_temp(): |
| 383 | + try_delete(d) |
382 | 384 |
|
383 |
| - atexit.register(clean_temp) |
384 |
| - prepare_to_clean_temp(EMSCRIPTEN_TEMP_DIR) # this global var might change later |
| 385 | + atexit.register(clean_temp) |
| 386 | + # this global var might change later |
| 387 | + prepare_to_clean_temp(EMSCRIPTEN_TEMP_DIR) |
385 | 388 | return EMSCRIPTEN_TEMP_DIR
|
386 | 389 |
|
387 | 390 |
|
@@ -422,9 +425,13 @@ def __init__(self):
|
422 | 425 | atexit.register(lock.release)
|
423 | 426 |
|
424 | 427 | def get_temp_files(self):
|
425 |
| - return tempfiles.TempFiles( |
426 |
| - tmpdir=self.TEMP_DIR if not DEBUG else get_emscripten_temp_dir(), |
427 |
| - save_debug_files=os.environ.get('EMCC_DEBUG_SAVE')) |
| 428 | + if DEBUG_SAVE: |
| 429 | + # In debug mode store all temp files in the emscripten-specific temp dir |
| 430 | + # and don't worry about cleaning them up. |
| 431 | + return tempfiles.TempFiles(get_emscripten_temp_dir(), save_debug_files=True) |
| 432 | + else: |
| 433 | + # Otherwise use the system tempdir and try to clean up after ourselves. |
| 434 | + return tempfiles.TempFiles(self.TEMP_DIR, save_debug_files=False) |
428 | 435 |
|
429 | 436 |
|
430 | 437 | def apply_configuration():
|
|
0 commit comments