title: Basic cygwin commands from python subprocess
body: <p>I want to run cygwin from python and execute cygwin commands.</p>
  
  <p>I am using Windows, so I want to run commands in cygwin not cmd. I am using Python 3.6.1.</p>
  
  <p>I just want to know how to run basic commands so I can work from there like <code>ls</code>. I have tried:</p>
  
  <ul>
  <li><code>subprocess.call("E:/cygwin/bin/bash.exe", "ls")</code> (something like this, but it does not work)</li>
  <li>the solution below suggested by @pstatix, which uses Popen(). Running stdin.close() after stdin.write(b'ls') results in a <code>/usr/bin/bash: line 1: ls: command not found</code> error</li>
  </ul>
  
  <p>I am able to do the following:</p>
  
  <ul>
  <li><p>open cygwin: <code>subprocess.call("E:/cygwin/bin/bash.exe")</code></p></li>
  <li><p>(run commmands on Windows cmd: <code>subprocess.call("dir", shell=True)</code>)</p></li>
  </ul>
  
  <p>Is this possible in this format? 
  Does cygwin automatically close when I run the next python command, or do I need to exit before that?</p>
  
  <p>I am relatively new to this.</p>