擅长:python、mysql、java
<p><code>subprocess.call</code>是一个实用函数,它运行并等待进程返回。如果希望进程在后台运行而不需要Python等待它完成,则需要使用raw<code>Popen</code>构造函数:</p>
<pre><code>subprocess.Popen(["dtncpd", "/home/dtn2"], cwd="/home/dtn2/dtn-2.9.0/apps/")
</code></pre>
<p>我删除了<code>shell="false"</code>位,因为<a href="https://stackoverflow.com/questions/35400147/calling-subprocess-when-another-one-is-still-running-can-it-be#comment58502830_35400147">as I noted in the comments, it does the opposite of what you intend.</a></p>
<p>请注意,您的第二个子流程几乎肯定是错误的。在<code>os.listdir</code>和<code>os.stat</code>(或者仅在python3.5上,<code>os.scandir</code>)之间,您可以获得与{<cd7>}相比使用子进程更有效的相同信息。在</p>