Using outdated multiprocessing API calls to start and communicate with processes, is not recommended. The subprocess
module can be used instead.
1def subprocess_call_noncompliant():
2 import subprocess
3 with open("~/output.txt", "w") as f:
4 # Noncompliant: uses 'subprocess.call' with
5 # 'stdout = PIPE' or 'stderr = PIPE'.
6 subprocess.call("~/test.sh", stdout=subprocess.PIPE)
1def subprocess_call_compliant():
2 import subprocess
3 with open("~/output.txt", "w") as f:
4 # Compliant: uses 'subprocess.call' without
5 # 'stdout = PIPE' or 'stderr = PIPE'.
6 subprocess.call("~/test.sh", stdout=f)