From 4a51e59d12294676cadb44aa00ce3b58f92b530d Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 31 Oct 2006 10:20:40 +0000 Subject: build.py: Add support for the interact flag, backported from trunk --- lib/bb/build.py | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/lib/bb/build.py b/lib/bb/build.py index e0e5246f7..176a500dc 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -132,6 +132,7 @@ def exec_func_shell(func, d): deps = data.getVarFlag(func, 'deps', d) check = data.getVarFlag(func, 'check', d) + interact = data.getVarFlag(func, 'interactive', d) if check in globals(): if globals()[check](func, deps): return @@ -170,15 +171,16 @@ def exec_func_shell(func, d): se = so - # dup the existing fds so we dont lose them - osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] - oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] - ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] + if not interact: + # dup the existing fds so we dont lose them + osi = [os.dup(sys.stdin.fileno()), sys.stdin.fileno()] + oso = [os.dup(sys.stdout.fileno()), sys.stdout.fileno()] + ose = [os.dup(sys.stderr.fileno()), sys.stderr.fileno()] - # replace those fds with our own - os.dup2(si.fileno(), osi[1]) - os.dup2(so.fileno(), oso[1]) - os.dup2(se.fileno(), ose[1]) + # replace those fds with our own + os.dup2(si.fileno(), osi[1]) + os.dup2(so.fileno(), oso[1]) + os.dup2(se.fileno(), ose[1]) # execute function prevdir = os.getcwd() @@ -192,20 +194,21 @@ def exec_func_shell(func, d): except: pass - # restore the backups - os.dup2(osi[0], osi[1]) - os.dup2(oso[0], oso[1]) - os.dup2(ose[0], ose[1]) - - # close our logs - si.close() - so.close() - se.close() - - # close the backup fds - os.close(osi[0]) - os.close(oso[0]) - os.close(ose[0]) + if not interact: + # restore the backups + os.dup2(osi[0], osi[1]) + os.dup2(oso[0], oso[1]) + os.dup2(ose[0], ose[1]) + + # close our logs + si.close() + so.close() + se.close() + + # close the backup fds + os.close(osi[0]) + os.close(oso[0]) + os.close(ose[0]) if ret==0: if bb.msg.debug_level > 0: -- cgit 1.2.3-korg