Difference between whole string command and list of strings in popen
<p>I found most of the programmers suggest use list of strings to represent the command in popen. However, in my own project, I found a whole string works in more cases.</p>

<p>For example, the following works</p>

<pre><code>subprocess.Popen('pgrep -f "\./run"', stdout=subprocess.PIPE, shell=True).wait()
</code></pre>

<p>while</p>

<pre><code>subprocess.Popen(['pgrep', '-f', '"\./run"'], stdout=subprocess.PIPE, shell=True).wait()
</code></pre>

<p>does not.</p>

<p>May I know what's the difference between these two ways of implementation and why the second one does not work as expected?</p>