Reuse the spawn code
This commit is contained in:
parent
2bbedf988b
commit
02c697d862
@ -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]
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user