![]() urlopen ( ' ) assert b 'Directory listing' in resp. This is the use-case this post addresses.ĭef main (): proc = subprocess. Some sort of "quit" command), this is doable. If the child process has an orderly termination sequence (such as sending Would make it tricky to cleanly terminate the child process when we're done with Interact with it (via a known port, for example) in another thread. Sure, we could launch a child process with n in one thread and We'll have to look at some of the lower-level APIs. ![]() This would be difficult toĪchieve with APIs that just run a child process to completion synchronously, so Shut down the child process in an orderly way. We launch it as a child process, thenĬonnect clients to it and run some testing sequence. ![]() In this post I want to discuss a variation of this task that is lessĭirectly addressed - long-running child processes. It comes with several high-level APIs likeĬall, check_output and (starting with Python 3.5) run that areįocused at child processes our program runs and waits to complete. The Python subprocess module is a powerful swiss-army knife for launchingĪnd interacting with child processes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |