In python is os.sytem( ... ) blocking or not?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In python is os.sytem( ... ) blocking or not??

In python, when you do os.system( 'subprocess') is the python calling fork blocked while the subprocesses fork is run, or do they run concurrently???

19th Sep 2020, 1:17 AM
Rick Shiffman
Rick Shiffman - avatar
2 Answers
+ 3
os.system() calls the C function system(). It spawns a separate process, the implementation is different in each operating system. It is advised to use subprocess.call() instead. Check the official docs https://docs.python.org/3.8/library/os.html#os.system
19th Sep 2020, 5:22 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Tibor Santa, thanks for the help and the pointer to the python documentation.
19th Sep 2020, 7:29 AM
Rick Shiffman
Rick Shiffman - avatar