From: Yeongil Jang Date: Thu, 10 Jan 2013 12:42:21 +0000 (+0900) Subject: Show stdout and stderr log of post script using msger X-Git-Tag: 0.20~22 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6e1670323350bbb581f04b2445c0cd469c91e37;p=tools%2Fmic.git Show stdout and stderr log of post script using msger - Msger can't show and recode stdout and stderr log of post script because subprocess excuted post script with sys.stdout and sys.stderr. Then mic get the log using subprocess pipe and show log using msger. Signed-off-by: Yeongil Jang --- diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index 4a501dd..7a765c3 100644 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -1016,11 +1016,13 @@ class BaseImageCreator(object): try: try: - subprocess.call([s.interp, script], - preexec_fn = preexec, - env = env, - stdout = sys.stdout, - stderr = sys.stderr) + p = subprocess.Popen([s.interp, script], + preexec_fn = preexec, + env = env, + stdout = subprocess.PIPE, + stderr = subprocess.STDOUT) + for entry in p.communicate()[0].splitlines(): + msger.info(entry) except OSError, (err, msg): raise CreatorError("Failed to execute %%post script " "with '%s' : %s" % (s.interp, msg))