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): def get_name(self):
return self._command return self._command
def start(self): def start(self, standard_output=False):
args = self._command.split() args = self._command.split()
flags = gobject.SPAWN_SEARCH_PATH 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' return 'Dbus'
def start(self): def start(self):
args = self._command.split() Process.start(self, True)
flags = gobject.SPAWN_SEARCH_PATH
result = gobject.spawn_async(args, flags=flags, standard_output=True,
standard_error=True)
self._stdout = result[2]
dbus_file = os.fdopen(self._stdout) dbus_file = os.fdopen(self._stdout)
addr = dbus_file.readline() addr = dbus_file.readline()
addr = addr.strip() addr = addr.strip()