Work around seeming subprocess/threading bug in python 2.6.3.

This commit is contained in:
Kris Maglione 2009-10-17 19:38:31 -04:00
parent 26db14166b
commit ea0e1bbe5d
3 changed files with 5 additions and 6 deletions

View File

@ -1,5 +1,4 @@
from pygmi.util import call
from threading import Thread
__all__ = 'Menu', 'ClickMenu'
@ -9,8 +8,8 @@ def inthread(fn, action):
if action:
return action(res)
return res
if not action:
return run()
return run()
# Bug.
t = Thread(target=run)
t.daemon = True
t.start()

View File

@ -13,7 +13,7 @@ def call(*args, **kwargs):
input = kwargs.pop('input', None)
p = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, cwd=os.environ['HOME'],
**kwargs)
close_fds=True, **kwargs)
if not background:
return p.communicate(input)[0].rstrip('\n')

View File

@ -1,3 +1,4 @@
import datetime
import operator
import os
import re
@ -52,8 +53,7 @@ def load(self):
return re.sub(r'^.*: ', '', call('uptime')).replace(', ', ' ')
@defmonitor
def time(self):
from datetime import datetime
return datetime.now().strftime('%c')
return datetime.datetime.now().strftime('%c')
wmii.colrules = (
('gimp', '17+83+41'),