From: Huang Peng Date: Thu, 7 Aug 2008 02:27:51 +0000 (+0800) Subject: Check exist ibus, before start a new ibus. X-Git-Tag: 0.1.0.20080810~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50060320ffb1a03c08e1f88690c3670c51c7ec66;p=platform%2Fupstream%2Fibus.git Check exist ibus, before start a new ibus. --- diff --git a/launcher/ibus.in b/launcher/ibus.in index 1257411b..51d30cb1 100644 --- a/launcher/ibus.in +++ b/launcher/ibus.in @@ -23,6 +23,7 @@ import os import os.path import sys import time +import ibus daemon = "@prefix@/libexec/ibus-daemon" x11 = "@prefix@/libexec/ibus-x11" @@ -31,17 +32,27 @@ conf = "@prefix@/libexec/ibus-gconf" daemon_pid = 0 -logname = os.path.expanduser("~/.ibus-error") -os.close(0) -os.close(1) -os.close(2) +# logname = os.path.expanduser("~/.ibus-error") +# os.close(0) +# os.close(1) +# os.close(2) +# try: +# os.unlink(logname) +# except: +# pass +# fd = os.open(logname, os.O_CREAT | os.O_WRONLY) +# os.dup2(fd, 1) +# os.dup2(fd, 2) +bus = None + try: - os.unlink(logname) + bus = ibus.Bus() except: pass -fd = os.open(logname, os.O_CREAT | os.O_WRONLY) -os.dup2(fd, 1) -os.dup2(fd, 2) +if bus: + print >> sys.stderr, "Found an ibus-daemon has been started!" + sys.exit(1) + try: print "start ibus-daemon" daemon_pid = os.spawnv (os.P_NOWAIT, daemon, [daemon])