File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
openwisp_controller/connection/connectors Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 11import logging
22import socket
3+ import time
34from io import BytesIO , StringIO
45
56import paramiko
@@ -186,6 +187,7 @@ def exec_command(
186187 logger .info ("Executing command: {0}" .format (command ))
187188 # execute commmand
188189 try :
190+ start_cmd = time .perf_counter ()
189191 stdin , stdout , stderr = self .shell .exec_command (command , timeout = timeout )
190192 # re-raise socket.timeout to avoid being catched
191193 # by the subsequent `except Exception as e` block
@@ -199,7 +201,9 @@ def exec_command(
199201 # workaround https://github.com/paramiko/paramiko/issues/1815
200202 # workaround https://github.com/paramiko/paramiko/issues/1787
201203 # Ref. https://docs.paramiko.org/en/stable/api/channel.html#paramiko.channel.Channel.recv_exit_status # noqa
202- stdout .channel .status_event .wait (timeout = timeout )
204+ stdout .channel .status_event .wait (
205+ timeout = timeout - int (time .perf_counter () - start_cmd )
206+ )
203207 assert stdout .channel .status_event .is_set ()
204208 exit_status = stdout .channel .exit_status
205209 # log standard output
You can’t perform that action at this time.
0 commit comments