Chromium Code Reviews| 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..0f26c9ace4a7b2da980e1d71281cc5553020e438 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 0 |
|
Isaac (away)
2013/09/26 18:31:08
yikes. I believe this needs to be os._exit(0)
Siva Chandra
2013/09/26 20:24:13
I think in principle this should be the other way:
|
| + elif pid < 0: |
| + sys.exit('Unable to spawn a detached child process.') |
| + os.setsid() |
|
iannucci
2013/09/26 18:15:57
How does this process get cleaned up?
Siva Chandra
2013/09/26 18:30:06
There is another step which is always executed. Th
Isaac (away)
2013/09/26 18:31:08
Another process reads PID from a file and kills it
navabi
2013/09/26 19:56:00
Where does that happen again? I don't see the PID
Siva Chandra
2013/09/26 20:29:44
See below.
|
| + # 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 |