From b8a564f383c368632694ff2e305bf0ec3a6460aa Mon Sep 17 00:00:00 2001 From: "chengtao.liu" Date: Mon, 24 Mar 2014 15:43:42 +0800 Subject: [PATCH] process endless stdout of daemon launching --- commodule/autoexec.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/commodule/autoexec.py b/commodule/autoexec.py index b5a2878..7542720 100644 --- a/commodule/autoexec.py +++ b/commodule/autoexec.py @@ -45,9 +45,12 @@ def shell_command(cmd, timeout=15): killall(proc.pid) exit_code = -1 result = [] - else: - if not cmd.endswith('&'): - result = proc.stdout.readlines() or proc.stderr.readlines() + elif not cmd.endswith('&'): + while True: + line = proc.stdout.readline() + if not line or line.find('daemon started') >= 0: + break + result.append(line) return [exit_code, result] -- 2.7.4