
Untitled
By: a guest on
May 5th, 2012 | syntax:
None | size: 0.64 KB | hits: 8 | expires: Never
subprocess stdout data
def runCommand(commandLine):
print('############## Running command: ' + commandLine)
p = subprocess.Popen(commandLine, shell = True, stdout = subprocess.PIPE)
print (p.stdout.read().decode('utf-8'))
import subprocess
proc = subprocess.Popen('cmake', shell=True, stdout=subprocess.PIPE)
while proc.poll() is None:
output = proc.stdout.readline()
print output
# grep test test.txt
test
^
|
|------- this word is red
# grep test test.txt | cat
test
^
|
|------- no longer red
# grep test test.txt --color=always | cat
test
^
|
|------- red again
p.stdout.read
for line in p.stdout: