Index: client/bin/factory_ui |
diff --git a/client/bin/factory_ui b/client/bin/factory_ui |
index b7c3752b02dfe8e7412162eab4992fde31bc3c8a..f995da9b6d41caf077b4be65631d76bd1190fb29 100755 |
--- a/client/bin/factory_ui |
+++ b/client/bin/factory_ui |
@@ -38,6 +38,7 @@ import common |
import factory |
import factory_state |
import factory_ui_lib as ful |
+import utils |
from gtk import gdk |
from Xlib import X |
@@ -258,6 +259,21 @@ def state_change_handler(fd, cb_condition, test_db, test_state, ui_state): |
factory.log('state_change_handler got exception: %s', repr(e)) |
return True |
+def kill_active_test(control_pid): |
+ # Currently we kill the active test directly. |
+ # If we want to use the old way - notify main control to kill it, |
+ # then send USR1 to main control instead: |
+ # os.kill(control_pid, signal.SIGUSR1) |
+ active_test_data = factory.get_shared_data('active_test_data') |
+ if active_test_data is None: |
josephsih1
2011/03/04 02:13:11
As in kill_current_test_callback() in factory.py,
Hung-Te
2011/03/04 02:21:28
Actually we should (almost) never see this, becaus
|
+ return |
+ factory.log('KILLING active test %s' % repr(active_test_data)) |
+ try: |
+ utils.nuke_pid(active_test_data[1]) |
josephsih1
2011/03/04 02:13:11
In the original design, the subprocess killing is
Hung-Te
2011/03/04 02:21:28
These are in different processes, so it would not
|
+ # To remove the dependency of utils, use kill: |
+ # os.kill(active_test_data[1], signal.SIGTERM) |
+ except OSError, e: |
+ factory.log('Failed to kill test: ' + repr(e)) |
def grab_shortcut_keys(kbd_shortcut_set, control_pid): |
disp = X_Display() |
@@ -287,7 +303,7 @@ def grab_shortcut_keys(kbd_shortcut_set, control_pid): |
keycode = xevent.detail |
factory.set_shared_data('activated_kbd_shortcut', |
keycode_map[keycode]) |
- os.kill(control_pid, signal.SIGUSR1) |
+ kill_active_test(control_pid) |
return True |
gobject.io_add_watch(root.display, gobject.IO_IN, handle_xevent) |