Saluti a tutti, devo effettuare un tunnel ssh, aprire un programma exe con wine (e fino a qui ci sono) ma alla chiusura del programma exe vorrei che anche il tunnel ssh si chiuda. Dovrei fare un break se wine o il programma exe viene chiuso, ma non come farlo e google non mi è stato tanto amico.
il codice è il seguente: from sshtunnel import open_tunnel from time import sleep import os,subprocess ssh_ip_tun = '192.168.2.1' ssh_porta_tun = 22 ssh_username_tun = 'admin' ssh_pwd_tun = 'password' ip_dispositivo_remoto = '192.168.2.25' porta_dispositivo_remoto = 8291 with open_tunnel((ssh_ip_remoto, ssh_porta_remota),ssh_username=ssh_username_tun,ssh_password=ssh_pwd_tun,remote_bind_address=(ip_dispositivo_remoto, porta_dispositivo_remoto)) as server: print(server.local_bind_port) subprocess.Popen(['wine',os.path.abspath('.')+os.sep+'winbox.exe','127.0.0.1: '+str(server.local_bind_port)]) while True: sleep(1) print('END!') Grazie Marcello
_______________________________________________ Python mailing list Python@lists.python.it https://lists.python.it/mailman/listinfo/python