Reuse the spawn code

This commit is contained in:
Marco Pesenti Gritti 2006-07-12 22:24:49 +02:00
parent 2bbedf988b
commit 02c697d862
2 changed files with 5 additions and 8 deletions

View File

@ -11,7 +11,9 @@ class Process:
def get_name(self):
return self._command
def start(self):
def start(self, standard_output=False):
args = self._command.split()
flags = gobject.SPAWN_SEARCH_PATH
result = gobject.spawn_async(args, flags=flags)
result = gobject.spawn_async(args, flags=flags,
standard_output=standard_output)
self._stdout = result[2]

View File

@ -22,12 +22,7 @@ class DbusProcess(Process):
return 'Dbus'
def start(self):
args = self._command.split()
flags = gobject.SPAWN_SEARCH_PATH
result = gobject.spawn_async(args, flags=flags, standard_output=True,
standard_error=True)
self._stdout = result[2]
Process.start(self, True)
dbus_file = os.fdopen(self._stdout)
addr = dbus_file.readline()
addr = addr.strip()