Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, command: List[str], i: str):
self.command = command
# create child process attached to a pty we can read from and write to
(child_pid, fd) = pty.fork()
if child_pid == 0:
# this is the child process fork.
# anything printed here will show up in the pty, including the output
# of this subprocess
print("starting subprocess")
subprocess.run(
f"echo new-ui mi2 `tty` > /tmp/gdbguitty{i}.txt",
shell=True,
env={"PS1": ""},
)
print("cat complete, now running command")
subprocess.run(command, env={"PS1": ""})
print("finshed...")
# os.execvpe(command[0], command[0:], {"PS1": ""})
else:
# this is the parent process fork.