Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # Virtual Me2Me implementation. This script runs and manages the processes | 6 # Virtual Me2Me implementation. This script runs and manages the processes |
| 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop | 7 # required for a Virtual Me2Me desktop, which are: X server, X desktop |
| 8 # session, and Host process. | 8 # session, and Host process. |
| 9 # This script is intended to run continuously as a background daemon | 9 # This script is intended to run continuously as a background daemon |
| 10 # process, running under an ordinary (non-root) user account. | 10 # process, running under an ordinary (non-root) user account. |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 # Close the temporary file-descriptors. | 773 # Close the temporary file-descriptors. |
| 774 os.close(devnull_fd) | 774 os.close(devnull_fd) |
| 775 os.close(log_fd) | 775 os.close(log_fd) |
| 776 | 776 |
| 777 | 777 |
| 778 def cleanup(): | 778 def cleanup(): |
| 779 logging.info("Cleanup.") | 779 logging.info("Cleanup.") |
| 780 | 780 |
| 781 global g_desktops | 781 global g_desktops |
| 782 for desktop in g_desktops: | 782 for desktop in g_desktops: |
| 783 if desktop.x_proc: | 783 for proc, name in [(desktop.x_proc, "Xvfb"), |
| 784 logging.info("Terminating Xvfb") | 784 (desktop.session_proc, "session"), |
| 785 desktop.x_proc.terminate() | 785 (desktop.host_proc, "host")]: |
| 786 if proc is not None: | |
| 787 logging.info("Terminating " + name) | |
| 788 proc.terminate() | |
|
rmsousa
2014/10/07 23:01:36
Since we're changing this logic, should we also wa
Lambros
2014/10/08 01:30:53
Done.
| |
| 789 | |
| 786 g_desktops = [] | 790 g_desktops = [] |
| 787 if ParentProcessLogger.instance(): | 791 if ParentProcessLogger.instance(): |
| 788 ParentProcessLogger.instance().release_parent() | 792 ParentProcessLogger.instance().release_parent() |
| 789 | 793 |
| 790 class SignalHandler: | 794 class SignalHandler: |
| 791 """Reload the config file on SIGHUP. Since we pass the configuration to the | 795 """Reload the config file on SIGHUP. Since we pass the configuration to the |
| 792 host processes via stdin, they can't reload it, so terminate them. They will | 796 host processes via stdin, they can't reload it, so terminate them. They will |
| 793 be relaunched automatically with the new config.""" | 797 be relaunched automatically with the new config.""" |
| 794 | 798 |
| 795 def __init__(self, host_config): | 799 def __init__(self, host_config): |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1237 else: | 1241 else: |
| 1238 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) | 1242 logging.info("Host exited with status %s." % os.WEXITSTATUS(status)) |
| 1239 elif os.WIFSIGNALED(status): | 1243 elif os.WIFSIGNALED(status): |
| 1240 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) | 1244 logging.info("Host terminated by signal %s." % os.WTERMSIG(status)) |
| 1241 | 1245 |
| 1242 | 1246 |
| 1243 if __name__ == "__main__": | 1247 if __name__ == "__main__": |
| 1244 logging.basicConfig(level=logging.DEBUG, | 1248 logging.basicConfig(level=logging.DEBUG, |
| 1245 format="%(asctime)s:%(levelname)s:%(message)s") | 1249 format="%(asctime)s:%(levelname)s:%(message)s") |
| 1246 sys.exit(main()) | 1250 sys.exit(main()) |
| OLD | NEW |