diff --git a/pisi/actionsapi/shelltools.py b/pisi/actionsapi/shelltools.py index 6821305d..2772809e 100644 --- a/pisi/actionsapi/shelltools.py +++ b/pisi/actionsapi/shelltools.py @@ -200,4 +200,4 @@ def dirName(sourceFile): def system(command): command = command.replace(" ", "") - run_batch(command) + run_batch(command, True) diff --git a/pisi/util.py b/pisi/util.py index c6485041..efddea3f 100644 --- a/pisi/util.py +++ b/pisi/util.py @@ -125,16 +125,24 @@ def remove_prefix(a,b): # Process Releated Functions # ############################## -def run_batch(cmd): - """run command non-interactively and report return value and output""" +def run_batch(cmd, realtime = False): + """run command non-interactively/realtime and report return value and output""" ctx.ui.info(_('running ') + cmd) - a = os.popen(cmd) - lines = a.readlines() - ret = a.close() + p = os.popen(cmd) + if realtime: + while 1: + line = p.readline() + if not line: + break + ctx.ui.debug(line[:-1]) + return p.close() + else: + lines = p.readlines() + ret = p.close() ctx.ui.debug(_('return value %s') % ret) successful = ret == None if not successful: - ctx.ui.error(_('Failed command: %s') % cmd + strlist(lines)) + ctx.ui.error(_('Failed command: %s') % cmd + strlist(lines)) return (successful,lines) ######################