i am currently hooking into another running exe with subprocess
import subprocess
cmd = "process.exe"
proc = subprocess.Popen(cmd, shell=True, bufsize=256, stdout=subprocess.PIPE)
def subprocess_readlines(out):
while True:
line = out.readline()
if not line:
return
yield line
for line in subprocess_readlines(proc.stdout):
print(">>>", line.rstrip().decode("utf-8"))
the original program itself is written in Go, and it clears the window using cls
clearFuncMap["windows"] = func() {
cmd := exec.Command("cmd", "/c", "cls")
cmd.Stdout = os.Stdout
cmd.Run()
}
How do I capture this cls command and clear my own output accordingly? My goal here is to redirect all output to be sent via a Discord channel, but restructing my the entire Go code to run with discord will be too time consuming.