python file:
def call_with_output(cmd: str, file: str):
# print("# %s" % cmd)
host = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
while True:
try:
build_data = host.stdout.readline().decode('utf-8')
sys.stdout.flush()
# print(build_data)
_write(file, build_data, "a")
except OSError as error:
if error == errno.ENOENT:
print("no such file")
elif error == errno.EPERM:
print("permission denied")
break
if not build_data:
break
host.wait()
return host.returncode
Why Python subprocesses get stuck?
Pulling up maven install in the shell executes it properly But when pulling up maven install in the pipeline, it gets stuck in the sub-processes pulled up by python