Simplify redirecting output to the console

This commit is contained in:
Marco Pesenti Gritti
2006-05-23 16:02:13 -04:00
parent f2e9500a9b
commit 03af8bceea
5 changed files with 20 additions and 20 deletions
+8
View File
@@ -1,3 +1,6 @@
import os
import sys
import dbus
class LogWriter:
@@ -7,6 +10,11 @@ class LogWriter:
proxy_obj = bus.get_object('com.redhat.Sugar.Logger', '/com/redhat/Sugar/Logger')
self._logger = dbus.Interface(proxy_obj, 'com.redhat.Sugar.Logger')
def start(self):
if os.environ.has_key('SUGAR_USE_CONSOLE'):
sys.stdout = self
sys.stderr = self
def write(self, s):
try:
self._logger.log(self._application, s)
+1 -3
View File
@@ -9,7 +9,7 @@ import gtk
from sugar.shell import shell
from sugar import env
def start(console):
def start():
shell.main()
activities = []
@@ -34,8 +34,6 @@ def start(console):
for activity in activities:
args = [ 'python', '-m', activity ]
if console:
args.append('--console')
os.spawnvp(os.P_NOWAIT, 'python', args)
try: