Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: tools/dom/scripts/multiemitter.py

Issue 18534002: Adding debug information to multiemitter.py (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/multiemitter.py
diff --git a/tools/dom/scripts/multiemitter.py b/tools/dom/scripts/multiemitter.py
index 19d90003be7332b21aed11b1c6047d8a794b1f2d..53989958a524cceac4f5760b866e0813abfb108b 100644
--- a/tools/dom/scripts/multiemitter.py
+++ b/tools/dom/scripts/multiemitter.py
@@ -7,6 +7,8 @@
import os
import re
+import sys
+import subprocess
import emitter
import logging
@@ -72,14 +74,33 @@ def _WriteFile(path, lines):
# Ensure dir exists.
if dir:
if not os.path.isdir(dir):
+ _logger.info('Mkdir - %s' % dir)
os.makedirs(dir)
# Remove file if pre-existing.
if os.path.exists(path):
+ _logger.info('Removing - %s' % path)
os.remove(path)
# Write the file.
- # _logger.info('Flushing - %s' % path)
- f = open(path, 'w')
- f.writelines(lines)
- f.close()
+ try:
+ _logger.info('Writing - %s' % path)
+ f = open(path, 'w')
+ f.writelines(lines)
+ f.close()
+ except OSError as error:
+ # FIXME(kustermann): Remove this later on.
+ # We try to get more debugging information to figure out why we sometimes
+ # get a "Permission denied" error when opening the file for writing.
+ # (hypothesis: Another process has already opened the file.)
+ _logger.info('Got exception (%s) ' % error)
+
+ if sys.platform == 'win32':
+ handle_file = r'E:\handle.exe'
+ if os.path.exists(handle_file):
+ _logger.info('Running handle.exe for debugging purposes')
+ subprocess.call([handle_file])
+ else:
+ _logger.info("Couldn't find %s. Not printing open handles."
+ % handle_file)
+ raise error
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698