Merge lp:~brandontschaefer/unity/ibus-daemon-workaroud-attempt3 into lp:unity

Proposed by Brandon Schaefer
Status: Rejected
Rejected by: Christopher Townsend
Proposed branch: lp:~brandontschaefer/unity/ibus-daemon-workaroud-attempt3
Merge into: lp:unity
Diff against target: 35 lines (+13/-4)
1 file modified
tests/autopilot/unity/tests/test_ibus.py (+13/-4)
To merge this branch: bzr merge lp:~brandontschaefer/unity/ibus-daemon-workaroud-attempt3
Reviewer Review Type Date Requested Status
Christopher Townsend Disapprove
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+188944@code.launchpad.net

Commit message

Kill the all the ibus-daemon process each test... attempting to beat out the k-indicator which seems to like to steal events from ibus...

Description of the change

Kill the all the ibus-daemon process each test... attempting to beat out the k-indicator which seems to like to steal events from ibus...

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Stephen M. Webb (bregma) wrote :

Python recommends you replace os.spawnlp() with subprocess.Popen().

Instead of waiting 5 seconds you could use ps to poll every second (up to some max, like 10 s) to see if the ibus daemon has started.

The processes won't become zombies if you use os.waitpid() to wait for the reaped children (Popen().pid could be useful here).

Revision history for this message
Christopher Townsend (townsend) wrote :

The ibus mess has been worked out in another package, so this MP is no longer needed.

review: Disapprove

Unmerged revisions

3547. By Brandon Schaefer

* Try a different way to start the ibus-daemon...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/unity/tests/test_ibus.py'
2--- tests/autopilot/unity/tests/test_ibus.py 2013-09-25 21:38:24 +0000
3+++ tests/autopilot/unity/tests/test_ibus.py 2013-10-02 21:55:34 +0000
4@@ -25,6 +25,8 @@
5 from gi.repository import GLib
6 from gi.repository import IBus
7 import os
8+import signal
9+import subprocess
10 from time import sleep
11 import time
12 import dbus
13@@ -120,11 +122,18 @@
14 This method adds a cleanUp to reset the old keys once the test is done.
15
16 """
17- # FIXME, if im-config is not set to ibus by default, a baad ibus-daemon is start
18+ # FIXME, if im-config is not set to ibus by default, a baad ibus-daemon is started
19 # which doesn't allow ibus to work! Replace it with a useable one for now...
20- os.spawnlp(os.P_NOWAIT, "ibus-daemon", "ibus-daemon", "--replace", "--xim")
21-
22- sleep(10)
23+ # kill all ibus-daemons (some will be defunct), but we need to restart a deamon each time...
24+ output = subprocess.Popen(['pgrep', '-f', 'ibus-daemon'], stdout=subprocess.PIPE).communicate()[0]
25+
26+ for pid in output.split():
27+ os.kill(int(pid), signal.SIGTERM)
28+ sleep(1)
29+
30+ if len(output.split()) > 0:
31+ os.spawnlp(os.P_NOWAIT, "ibus-daemon", "ibus-daemon", "--xim")
32+ sleep(5)
33
34 bus = get_ibus_bus()
35 config = bus.get_config()