@@ -21,10 +21,13 @@ from autopilot.introspection import (
2121 get_proxy_object_for_existing_process,
2222 ProcessSearchError,
2323)
24+import logging
2425import subprocess
2526from unity8.shell.emulators import UnityEmulatorBase
2627from unity8.shell.emulators.main_window import MainWindow
2728
29+logger = logging.getLogger(__name__)
30+
2831
2932class CannotAccessUnity(Exception):
3033 pass
@@ -75,13 +78,11 @@ def restart_unity_with_testability(*args):
7578 Passes *args arguments to the launched process.
7679
7780 """
78− print("Retarting unity with testability.")
7981 args += ("QT_LOAD_TESTABILITY=1",)
8082 return restart_unity(*args)
8183
8284
8385def restart_unity_normally():
84− print("Restarting unity normally.")
8586 restart_unity()
8687
8788
@@ -97,22 +98,25 @@ def restart_unity(*args):
9798 status = _get_unity_status()
9899 if "start/" in status:
99100 try:
100− print("Stopping unity.")
101− subprocess.check_call(['initctl', 'stop', 'unity8'])
101+ output = subprocess.check_output(['initctl', 'stop', 'unity8'])
102+ logger.info(output)
102103 except subprocess.CalledProcessError as e:
103− e.args += ("Failed to stop running instance of unity8", )
104+ e.args += (
105+ "Failed to stop running instance of unity8: %s" % e.output,
106+ )
104107 raise
105108
106109 try:
107110 command = ['initctl', 'start', 'unity8'] + list(args)
108− subprocess.check_call(
111+ output = subprocess.check_output(
109112 command,
110113 stderr=subprocess.STDOUT,
114+ universal_newlines=False,
111115 )
112−
116+ logger.info(output)
113117 pid = _get_unity_pid()
114118 except subprocess.CalledProcessError as e:
115− e.args += ("Failed to start unity8 with", )
119+ e.args += ("Failed to start unity8: %s" % e.output,)
116120 raise
117121 else:
118122 return _get_unity_proxy_object(pid)