-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexe.py
More file actions
29 lines (26 loc) · 659 Bytes
/
exe.py
File metadata and controls
29 lines (26 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 21 23:20:37 2022
@author: a2362
"""
from subprocess import Popen,PIPE
import sys
def main():
a=""
p=Popen(["gtp.py"],shell=True,stdin=PIPE,stdout=PIPE,bufsize=0,universal_newlines=True)
while True:
a=input()
if a=="quit":
p.kill()
sys.exit()
if a==""or a=="\n":
continue
p.stdin.write(a+'\n')
sys.stdin.flush()
output=p.stdout.readline()
while output!="EOF\n":
sys.stdout.write(output)
sys.stdout.flush()
output=p.stdout.readline()
if __name__=='__main__':
main()