Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2007-11-29 13:50:52 (GMT)
committer Simon Schampijer <simon@schampijer.de>2007-11-29 13:50:52 (GMT)
commitab1cdc7a3011696eac2aecbc444eee788903557b (patch)
tree5b96ac2063de47ac2d2128e6432510bec8989c81 /lib
parent8c72c8033757c0624c57b3dc597cbaae0248e448 (diff)
parent586d6caff1fc566031060eab357418f68e8cf099 (diff)
Merge branch 'master' of ssh+git://dev.laptop.org/git/sugar
Diffstat (limited to 'lib')
-rw-r--r--lib/sugar/activity/activityfactory.py16
-rw-r--r--lib/sugar/bundle/bundle.py2
-rw-r--r--lib/sugar/env.py2
3 files changed, 16 insertions, 4 deletions
diff --git a/lib/sugar/activity/activityfactory.py b/lib/sugar/activity/activityfactory.py
index 85c0832..119dcea 100644
--- a/lib/sugar/activity/activityfactory.py
+++ b/lib/sugar/activity/activityfactory.py
@@ -18,6 +18,7 @@
import logging
import subprocess
+import signal
import dbus
import gobject
@@ -53,6 +54,16 @@ _RAINBOW_SERVICE_NAME = "org.laptop.security.Rainbow"
_RAINBOW_ACTIVITY_FACTORY_PATH = "/"
_RAINBOW_ACTIVITY_FACTORY_INTERFACE = "org.laptop.security.Rainbow"
+_children_pid = []
+
+def _sigchild_handler(signum, frame):
+ for child_pid in _children_pid:
+ pid, status = os.waitpid(child_pid, os.WNOHANG)
+ if pid > 0:
+ _children_pid.remove(pid)
+
+signal.signal(signal.SIGCHLD, _sigchild_handler)
+
def create_activity_id():
"""Generate a new, unique ID for this activity"""
pservice = presenceservice.get_instance()
@@ -224,8 +235,9 @@ class ActivityCreationHandler(gobject.GObject):
self._handle.uri)
if not self._use_rainbow:
- process = subprocess.Popen(command, env=environ, cwd=activity.path,
- stdout=log_file, stderr=log_file)
+ p = subprocess.Popen(command, env=environ, cwd=activity.path,
+ stdout=log_file, stderr=log_file)
+ _children_pid.append(p.pid)
else:
log_file.close()
system_bus = dbus.SystemBus()
diff --git a/lib/sugar/bundle/bundle.py b/lib/sugar/bundle/bundle.py
index 33fd1a8..f7f18c9 100644
--- a/lib/sugar/bundle/bundle.py
+++ b/lib/sugar/bundle/bundle.py
@@ -108,7 +108,7 @@ class Bundle:
raise AlreadyInstalledException
if not os.path.isdir(install_dir):
- os.mkdir(install_dir)
+ os.mkdir(install_dir, 0775)
# zipfile provides API that in theory would let us do this
# correctly by hand, but handling all the oddities of
diff --git a/lib/sugar/env.py b/lib/sugar/env.py
index ea0be7b..33b57f3 100644
--- a/lib/sugar/env.py
+++ b/lib/sugar/env.py
@@ -55,7 +55,7 @@ def get_profile_path(path=None):
base = os.path.join(os.path.expanduser('~/.sugar'), profile_id)
if not os.path.isdir(base):
try:
- os.makedirs(base)
+ os.makedirs(base, 0770)
except OSError, exc:
print "Could not create user directory."