I'm currently working with Python and Bash to run a backend of a web application. I've inhereted this project and am tasked to do modifications on it, therefore I don't have a good knowledge about what the person who wrote this code had intended to do, so sorry if my question seems a bit disconnected at places.
What I'm currently doing is using Python to call a subprocess via .Popen() which executes a Bash Script, after that, I use .communicate() on the return value of this subprocess to gather the stdout and stderr from it, if the later is not empty, I run checks on what it contains and act further accordingly.
However, it doesn't appear clear to me what kind of error is written into "stderr". Shouldn't an "exit 1" for example be logged in stderr? Does stderr only concern itself with errors that occur while executing .Popen()? And is there a way to have an error logged in stderr from inside the Bash Script that is being run?