I've been developing software that opens a cmd, and lets another user control it like ssh. I want that to respect things like cd, and not just throw them away, like using multiple processes does; so i have used one sub-process. However, problem arises when trying to pipeline the output of the sub-process more than once: it just returns ""! Please help!
RELEVANT CODE:
print("attempting to open subprocesses")
process = Popen("echo \"im alive!\"", shell=True, stdin=PIPE, stdout=PIPE)
process.wait()
process.stdin.write(bytes(data, "utf-8"))
process.wait()
while True:
print("..inloop")
output = process.stdout.readline().decode("utf-8")
if output == '' and process.poll() is not None:
break
if output:
print("outputting")
hc.broadcast_data("sentinelkey", output, connections,
server_socket)