diff --git a/main.py b/main.py index 5b5c3d5..5ff30c1 100644 --- a/main.py +++ b/main.py @@ -29,16 +29,13 @@ ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # Ignore host key REMO ssh.connect(hostname, username=sshuser, key_filename=sshkeylocation) # Attempt to connect channel = ssh.invoke_shell() # Get a new shell(, and keep it open, since we need to exec multiple commands depending on the last command being executed successfully.) -def ssh_runcmd(command): # ssh_runcmd +def ssh_runcmd(command): # Some abstraction to run ssh commands. # Input validation if not type(command) is str: raise TypeError("ssh_runcmd: command must be a string, '" + command + "' is not.") channel.send(command + '\n') # Execute command. - while not channel.recv_ready(): # Wait for output to be recieved. - sleep(0.5) # The command could still be writing to output buffer after running for 0.5s. Assuming during the period we read the buffer, cmd can keep up with us, or at least till the 8th KiB end. - cmdout = "" # Init lockedoutCounter = 0 # Init