title: How many kinds of returncode of subprocess.wait()
body: <p>I'm so confused about a python-file , which used for copying files from sever to hadoop.</p>
  
  <p>the cmd is: <code>hadoop fs -put /localhost/* /hadoop/*</code>
  the code is:</p>
  
  <pre><code>    cmd = exc_path + ' ' + 'fs -put' + ' ' + src_path + item + ' ' + dst_path
      process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
      code = process.wait()
      logfile.info('type(code) is %s, code is %s\n', type(code), code)
  </code></pre>
  
  <p>For the past several days, it runs ok. But the day before yesterday it returned <code>code!=0</code> 
  Then yesterday, it ran ok, the <code>code == 0</code>, and then today it fails and returned : <code>type(code) is &lt;type 'int'&gt;, code is 255</code></p>
  
  <p>The doc says the <code>wait()</code> should return 0 or None, so why do I get a 255? And the cmd 'put' of hadoop should return 0 (when success) and -1 (when fail).</p>
  
  <p>I have found some useful infomation:
      "Sadly when running your subprocess using shell=True, wait() will only wait for the sh subprocess to finish and not for the command cmd."  <a href="https://stackoverflow.com/questions/6341358/subprocess-wait-not-waiting-for-popen-process-to-finish-when-using-threads">from</a></p>