How does this code look in terms of errors and performance -
- Until yesterday, I had no idea what subprocess does. I wrote this code looking at various blogs. Therefore, could someone please have a look and see if I made any glaring error.
- Am I missing any convenient feature that experienced programs that add with the
runcommand?
import subprocess
with open("stdout.txt", "w") as stdout, open("stderr.txt", "w") as stderr:
result = subprocess.run(["bash", "test.sh", "2"], stdout=stdout, stderr=stderr,text=True, check=True)
This is my bash script -
echo "Hello World $1"
printf
printf was added to ensure that an error will be created
Please let me know if you have any questions. Thank you!