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

Unified Diff: build/android/adb_logcat_printer.py

Issue 1838483002: Create output dir in logcat printer if it doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: words Created 4 years, 9 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: build/android/adb_logcat_printer.py
diff --git a/build/android/adb_logcat_printer.py b/build/android/adb_logcat_printer.py
index 55176ab9201333745d63f878bcdcb68118efe95a..a715170759d8bf0e6206a0b2da255789fccfdc72 100755
--- a/build/android/adb_logcat_printer.py
+++ b/build/android/adb_logcat_printer.py
@@ -159,10 +159,6 @@ def main(argv):
if len(args) != 1:
parser.error('Wrong number of unparsed args')
base_dir = args[0]
- if options.output_path:
- output_file = open(options.output_path, 'w')
- else:
- output_file = sys.stdout
log_stringio = cStringIO.StringIO()
logger = logging.getLogger('LogcatPrinter')
@@ -172,6 +168,19 @@ def main(argv):
' %(message)s'))
logger.addHandler(sh)
+ if options.output_path:
+ if not os.path.exists(os.path.dirname(options.output_path)):
+ logger.warning('Output dir %s doesn\'t exist. Creating it.',
+ os.path.dirname(options.output_path))
+ os.makedirs(os.path.dirname(options.output_path))
+ output_file = open(options.output_path, 'w')
+ logger.info('Dumping logcat to local file %s. If running in a build, '
+ 'this file will likely will be uploaded to google storage '
+ 'in a later step. It can be downloaded from there.',
+ options.output_path)
+ else:
+ output_file = sys.stdout
+
try:
# Wait at least 5 seconds after base_dir is created before printing.
#
« 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