From dabab6213bddfd4017dcccd5909936d96eb57611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Mon, 13 Feb 2006 03:14:54 +0000 Subject: [PATCH] =?UTF-8?q?-d=20=C3=A7=C4=B1kt=C4=B1=20versin...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/actionsapi/shelltools.py | 2 +- pisi/util.py | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) 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) ######################