Created
October 2, 2014 20:30
-
-
Save vindir/17b8c2ed3ac59f4026f1 to your computer and use it in GitHub Desktop.
subprocess examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Simple process Popen object | |
| proc = subprocess.Popen([echo, '-n', my_combo_breaker], stdout=subprocess.PIPE) | |
| # Dumping standard out to a var | |
| #proc = subprocess.Popen([echo, '-n', my_combo_breaker], stdout=subprocess.PIPE).stdout.read().strip() | |
| # Piping output of echo to pbcopy | |
| #echo_out = subprocess.Popen([echo, '-n', my_combo_breaker], stdout=subprocess.PIPE) | |
| #subprocess.Popen(['pbcopy'], stdin=echo_out) | |
| # Doing it sensibly and just pushing stdin (broken currently) | |
| pbcopy = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE) | |
| pbcopy.communicate(input=my_combo_breaker) | |
| ~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment