You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
742 B
20 lines
742 B
4 years ago
|
import subprocess
|
||
|
lCMD = "for /l %x in (1, 1, 5) do echo %x && ping 127.0.0.1 -n 2"
|
||
|
lCMD = "git status"
|
||
|
proc = subprocess.Popen(f'cmd /c {lCMD}', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||
|
# proc = subprocess.Popen('notepad', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||
|
#proc = subprocess.Popen('cmd /c git status', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||
|
#proc = subprocess.run(f'cmd /c {lCMD}', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||
|
print(123)
|
||
|
#import pdb
|
||
|
#pdb.set_trace()
|
||
|
#tmp = proc.stdout.read()
|
||
|
lListenBool = True
|
||
|
while lListenBool:
|
||
|
tmp = proc.stdout.readline()
|
||
|
if tmp == b"":
|
||
|
lListenBool = False
|
||
|
#tmp = proc.stdout
|
||
|
#print(tmp)
|
||
|
print(tmp.decode("cp866"))
|
||
|
print("Happy end")
|