[hackers] [wmii] Work around seeming subprocess/threading bug in python 2.6.3. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Sat, 17 Oct 2009 23:49:03 +0000 (UTC)

changeset: 2554:e7dccbb4544a
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Oct 17 19:38:31 2009 -0400
files: alternative_wmiircs/python/pygmi/menu.py alternative_wmiircs/python/pygmi/util.py alternative_wmiircs/python/wmiirc.py
description:
Work around seeming subprocess/threading bug in python 2.6.3.

diff -r aa72269e70f8 -r e7dccbb4544a alternative_wmiircs/python/pygmi/menu.py
--- a/alternative_wmiircs/python/pygmi/menu.py Sat Oct 17 04:34:17 2009 -0400
+++ b/alternative_wmiircs/python/pygmi/menu.py Sat Oct 17 19:38:31 2009 -0400
@@ -1,5 +1,4 @@
 from pygmi.util import call
-from threading import Thread
 
 __all__ = 'Menu', 'ClickMenu'
 
@@ -9,8 +8,8 @@
         if action:
             return action(res)
         return res
- if not action:
- return run()
+ return run()
+ # Bug.
     t = Thread(target=run)
     t.daemon = True
     t.start()
diff -r aa72269e70f8 -r e7dccbb4544a alternative_wmiircs/python/pygmi/util.py
--- a/alternative_wmiircs/python/pygmi/util.py Sat Oct 17 04:34:17 2009 -0400
+++ b/alternative_wmiircs/python/pygmi/util.py Sat Oct 17 19:38:31 2009 -0400
@@ -13,7 +13,7 @@
     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')
 
diff -r aa72269e70f8 -r e7dccbb4544a alternative_wmiircs/python/wmiirc.py
--- a/alternative_wmiircs/python/wmiirc.py Sat Oct 17 04:34:17 2009 -0400
+++ b/alternative_wmiircs/python/wmiirc.py Sat Oct 17 19:38:31 2009 -0400
@@ -1,3 +1,4 @@
+import datetime
 import operator
 import os
 import re
@@ -52,8 +53,7 @@
     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'),
Received on Sat Oct 17 2009 - 23:49:03 UTC

This archive was generated by hypermail 2.2.0 : Sun Oct 18 2009 - 00:00:16 UTC