[Android] Fork a detached child process from adb_logcat_monitor.py.
This way, we can invoke adb_logcat_monitor.py directly from recipes. We cannot spawn a process which runs adb_logcat_monitor.py (like we have been via buildbot/bb_device_steps.py) from recipes as we cannot import subprocess et al. from recipes. BUG=286509 Review URL: https://codereview.chromium.org/24456002 git-svn-id: http://src.chromium.org/svn/trunk/src/build@226151 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
ee9e53f78e
Коммит
10040db6a7
|
@ -96,6 +96,15 @@ def GetAttachedDevices(adb_cmd):
|
|||
|
||||
def main(base_dir, adb_cmd='adb'):
|
||||
"""Monitor adb forever. Expects a SIGINT (Ctrl-C) to kill."""
|
||||
# Spawn a detached child process.
|
||||
pid = os.fork()
|
||||
if pid > 0:
|
||||
os._exit(os.EX_OK)
|
||||
elif pid < 0:
|
||||
sys.exit('Unable to spawn a detached child process.')
|
||||
os.setsid()
|
||||
# The rest happens in the child process.
|
||||
|
||||
# We create the directory to ensure 'run once' semantics
|
||||
if os.path.exists(base_dir):
|
||||
print 'adb_logcat_monitor: %s already exists? Cleaning' % base_dir
|
||||
|
|
|
@ -285,7 +285,7 @@ def EscapeBuilderName(builder_name):
|
|||
|
||||
def SpawnLogcatMonitor():
|
||||
shutil.rmtree(LOGCAT_DIR, ignore_errors=True)
|
||||
bb_utils.SpawnCmd([
|
||||
bb_utils.RunCmd([
|
||||
os.path.join(CHROME_SRC_DIR, 'build', 'android', 'adb_logcat_monitor.py'),
|
||||
LOGCAT_DIR])
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче