GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — UniversalPython/test/test_shell.py at main · UniversalPython/UniversalPython Expand file tree/ Copy pathtest_shell.pyMore file actions 88 lines (58 loc) · 2.01 KB / Copy pathtest_shell.pyFile metadata and controls88 lines (58 loc) · 2.01 KB 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 # # client.py # # import socket # import subprocess # from threading import Thread # from time import sleep # # s = socket.socket() # # s.connect(('localhost', 1337)) # popen = None # def execute(cmd): # print ("im here") # popen = subprocess.Popen(cmd, # stdin=subprocess.PIPE, # stdout=subprocess.PIPE, universal_newlines=True) # for stdout_line in iter(popen.stdout.readline, ""): # yield stdout_line # popen.stdout.close() # return_code = popen.wait() # if return_code: # raise subprocess.CalledProcessError(return_code, cmd) # # Example # def output_loop(): # for path in execute(["python"]): # print(path, end="") # # Example # # await execute("python") # # print(path, end="") # if __name__ == "__main__": # input ("First input") # thread = Thread(target = output_loop) # thread.start() # thread.join() # sleep(2) # # popen.communicate(str(input("I am here")).encode('utf-8')) # popen.stdin.write(str(input("I am here").encode('utf-8'))) # sleep(2) # print("thread finished...exiting") # # popen = subprocess.Popen(['python',], stdout=subprocess.PIPE, universal_newlines=True) # # for stdout_line in iter(popen.stdout.readline, ""): # # yield stdout_line # # popen.communicate(str(input()).encode('utf-8')) # # popen.stdout.close() # # while (process.wait()): # # process.communicate(str(input()).encode('utf-8')) #from subprocess import Popen, PIPE #p1 = Popen(['python'],stdin=PIPE, stdout=PIPE) # # p2 = Popen(['sed', '/^$/d'], stdin=p1.stdout, stdout=PIPE) # # p3 = Popen(['awk', 'NR > 1 { print $2 }'], stdin=p2.stdout, stdout=PIPE) #p1.stdin.write("print('hello world!')".encode('utf-8')) #p1.wait() # stdout, _ = p1.communicate() #!/usr/bin/env python3 import time #from subprocess import Popen, PIPE import subprocess proc = subprocess.Popen("python", stdin=subprocess.PIPE) #while (proc.poll() is None): proc.stdin.write("print('hello world!!')".encode('utf-8')) # etc #time.sleep(4) |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |