开发者

In python, how can I do a non-blocking system call?

开发者 https://www.devze.com 2022-12-09 20:03 出处:网络
In Python, is it possible to do a non-blocking system call without forking off a thread?i.e.,开发者_如何学Python can I avoid:

In Python, is it possible to do a non-blocking system call without forking off a thread? i.e.,开发者_如何学Python can I avoid:

import thread
thread.start_new_thread(os.system,('cmd',))


Use the subprocess module (Popen) and have the result written to a file. You can either "wait" for the subprocess to terminate or proceed with other business and poll for the result in the file etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消