adb_profile_chrome: Use Enter to stop early instead of Ctrl-C
Use Enter to stop early instead of Ctrl-C so that users don't accidentally hit Ctrl-C during the trace downloading phase. BUG=337656 NOTRY=true Review URL: https://codereview.chromium.org/164203004 git-svn-id: http://src.chromium.org/svn/trunk/src/build@251661 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
1413e72314
Коммит
e66716840e
|
@ -10,6 +10,7 @@ import logging
|
|||
import optparse
|
||||
import os
|
||||
import re
|
||||
import select
|
||||
import shutil
|
||||
import sys
|
||||
import threading
|
||||
|
@ -263,6 +264,10 @@ def _PrintMessage(heading, eol='\n'):
|
|||
sys.stdout.flush()
|
||||
|
||||
|
||||
def _WaitForEnter(timeout):
|
||||
select.select([sys.stdin], [], [], timeout)
|
||||
|
||||
|
||||
def _StartTracing(controllers, interval):
|
||||
for controller in controllers:
|
||||
controller.StartTracing(interval)
|
||||
|
@ -307,14 +312,12 @@ def _CaptureAndPullTrace(controllers, interval, output, compress, write_html):
|
|||
try:
|
||||
_StartTracing(controllers, interval)
|
||||
if interval:
|
||||
_PrintMessage('Capturing %d-second %s. Press Ctrl-C to stop early...' % \
|
||||
_PrintMessage('Capturing %d-second %s. Press Enter to stop early...' % \
|
||||
(interval, trace_type), eol='')
|
||||
time.sleep(interval)
|
||||
_WaitForEnter(interval)
|
||||
else:
|
||||
_PrintMessage('Capturing %s. Press Enter to stop...' % trace_type, eol='')
|
||||
raw_input()
|
||||
except KeyboardInterrupt:
|
||||
_PrintMessage('\nInterrupted...', eol='')
|
||||
finally:
|
||||
_StopTracing(controllers)
|
||||
if interval:
|
||||
|
|
Загрузка…
Ссылка в новой задаче