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..0464b5303c1e04a422785260faf77553dd77fa9f 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: |
+ 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 |