mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 07:51:59 -09:00
support/testing/utils: fix get-developers test without a tty
get-developers will check its stdin to decide whether it is a tty or not, and behave differently whether it is or not. So, when we run the tests, we need an actual tty. However, when running in a CI pipeline, like on Gitlab-CI, there is no tty available on stdin. Fake one. We don't need anything too fancy, so just a slave pty will suffice. Fixes: https://gitlab.com/buildroot.org/buildroot/-/jobs/8830671800 Fixes:d10d22221f(utils/get-developers: read patch from stdin when it's not a tty) Reported-by: Julien Olivain <ju.o@free.fr> Signed-off-by: Yann E. MORIN <yann.morin@orange.com> Signed-off-by: Julien Olivain <ju.o@free.fr> (cherry picked from commit3778f704cd) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
ae0ec1dacb
commit
f022e05a26
@@ -15,10 +15,16 @@ import infra
|
||||
|
||||
def call_script(args, env, cwd):
|
||||
"""Call a script and return stdout and stderr as lists and the exit code."""
|
||||
proc = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE,
|
||||
# We need stdin to be a tty, not just a pipe or whatever
|
||||
m_tty, s_tty = os.openpty()
|
||||
proc = subprocess.Popen(args, cwd=cwd,
|
||||
stdin=s_tty,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, env=env,
|
||||
universal_newlines=True)
|
||||
out, err = proc.communicate()
|
||||
os.close(s_tty)
|
||||
os.close(m_tty)
|
||||
return out.splitlines(), err.splitlines(), proc.returncode
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user