title: prevent closing of DOS shell window opened via subprocess
body: <p>I'm trying to create a program (it will be used on Windows) to compress a list of files with 7-Zip and other stuff. </p>
  
  <p>I use <code>subprocess</code> to run the 7-Zip executable with the correct arguments.
  <code>subprocess</code> opens a DOS shell with the <code>7z.exe</code> output; this is good because there is a percentage indicator of file compression and sometimes the process could be very long. My problem is that the user will be able—voluntarily or accidentally—to interrupt the compression task either by</p>
  
  <ol>
  <li>clicking on the close button of the DOS window, or</li>
  <li>by pressing <kbd>Ctrl</kbd>-<kbd>C</kbd>.</li>
  </ol>
  
  <p>Is it possible to disable any kind of input to the DOS shell opened from <code>subprocess</code>?  Alternatively, how can I pass the output of the DOS shell to my program at runtime?  I tried with <code>process.stdout.read(1024)</code> and <code>process.communicate()</code>, but both read the output when the subprocess ended; not while it was running.</p>
  
  <p>I've used <code>subprocess.Popen()</code> instead of <code>subprocess.call()</code> so that I may run all 7-Zip tasks at the same time, but if will be helpful to solve my problem, I can change it. </p>
  
  <pre><code>for f in self.fileList:
      destination = self.newPath + "\\" + basename(f) + ".7z"
      arglist = [self.sevZipPath, "a", "-mx9", destination, f]
      sp = subprocess.Popen(
          args = arglist,
          cwd = self.newPath,
          shell = False
          )
  </code></pre>