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

Unified Diff: build/android/adb_logcat_monitor.py

Issue 24456002: [Android] Fork a detached child process from adb_logcat_monitor.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Exit parent process with os._exit Created 7 years, 3 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 | build/android/buildbot/bb_device_steps.py » ('j') | build/android/buildbot/bb_device_steps.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/adb_logcat_monitor.py
diff --git a/build/android/adb_logcat_monitor.py b/build/android/adb_logcat_monitor.py
index 35ef7905b24fcb9a30506f5e0d246d3f52085214..fc4e057392cc52fb4632e6a6cc4e83410f61c40d 100755
--- a/build/android/adb_logcat_monitor.py
+++ b/build/android/adb_logcat_monitor.py
@@ -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:
+ return os._exit(os.EX_OK)
iannucci 2013/09/26 21:30:57 I don't think this return will ever actually happe
Siva Chandra 2013/09/26 22:47:57 Didn't understand. The child process is already fo
iannucci 2013/09/26 23:57:29 s/return //
Siva Chandra 2013/09/27 00:55:00 Still did not undertstand :(
+ 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
« no previous file with comments | « no previous file | build/android/buildbot/bb_device_steps.py » ('j') | build/android/buildbot/bb_device_steps.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698