Simplify redirecting output to the console
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user