I have a python program that runs a script and this script writes its output to stdout, which I need to use later in my program. Since this script is in binary and I can't change it's source code, so I redirected the output of my script to a file, then I read the file as below :
os.popen("./my_script > test.txt")
with open("test.txt", "r") as f:
output = " ".join(f.readlines())
print(f"I can process my output : {output} here")
The program works great, until I try to deploy it to Cloud Run. The output is not redirected to a file, but automatically redirected to Cloud Logging, and I can no longer use it in my program.