From f6382159ef48e555ba338f7d4bfd19610a705a47 Mon Sep 17 00:00:00 2001
From: Wade Brainerd <wadetb@gmail.com>
Date: Tue, 29 Sep 2009 08:42:27 -0400
Subject: [PATCH] Notify shell when activity process terminates.
---
src/sugar/activity/activityfactory.py | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/sugar/activity/activityfactory.py b/src/sugar/activity/activityfactory.py
index ee0fd92..7ee5655 100644
a
|
b
|
class ActivityCreationHandler(gobject.GObject): |
278 | 278 | |
279 | 279 | gobject.child_watch_add(child.pid, |
280 | 280 | _child_watch_cb, |
281 | | (environment_dir, log_file)) |
| 281 | (environment_dir, log_file, self._shell, |
| 282 | self._service_name, self._handle.activity_id)) |
282 | 283 | |
283 | 284 | def _no_reply_handler(self, *args): |
284 | 285 | pass |
… |
… |
def create_with_object_id(bundle, object_id): |
338 | 339 | return ActivityCreationHandler(bundle, activity_handle) |
339 | 340 | |
340 | 341 | |
| 342 | def _no_reply_handler(*args): |
| 343 | pass |
| 344 | |
| 345 | def _notify_activity_ended_error_handler(err): |
| 346 | logging.error('Notify activity ended failed %s', err) |
| 347 | |
341 | 348 | def _child_watch_cb(pid, condition, user_data): |
342 | 349 | # FIXME we use standalone method here instead of ActivityCreationHandler's |
343 | 350 | # member to have workaround code, see #1123 |
344 | | environment_dir, log_file = user_data |
| 351 | environment_dir, log_file, shell, service_name, activity_id = user_data |
345 | 352 | if environment_dir is not None: |
346 | 353 | subprocess.call(['/bin/rm', '-rf', environment_dir]) |
347 | 354 | try: |
… |
… |
def _child_watch_cb(pid, condition, user_data): |
356 | 363 | except OSError: |
357 | 364 | # SIGCHLD = SIG_IGN, no zombies |
358 | 365 | pass |
| 366 | |
| 367 | shell.NotifyActivityEnded( |
| 368 | activity_id, reply_handler=_no_reply_handler, |
| 369 | error_handler=_notify_activity_ended_error_handler) |