471,337 Members | 1,025 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Closing pexpect connections using threads

I am trying to write a multi-threaded program and use pexpect along
with it. All works fine until I try to close the connection handle.
That thread keeps waiting until the connection handle closes. It
actually never comes out of that command(connection_handle.close()).
If I manually kill it using kill command, the thread comes out and
quits otherwise it is in the wait state forever.

def daemon(self):
self.continue_heartbeats = True
thrdHandshake = threading.Event()
threading.Thread(target=self.RunTests,name='Run_Te st_Thread')

while self.continue_heartbeats:
def RunTests(self):

def closeconnection()
self.log("Closing connection for device")
createconnection is a API which creates SSH connection to a remote machine.

And upon running, it hangs at this point
11:8:17:910 [DBG][CLEANUP]
11:8:17:910 [DBG]Closing Connection for device
<pexpect.spawn instance at 0xb7b373cc>
Any tips on what I am missing here?


Oct 3 '07 #1
0 1336

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by simon place | last post: by
4 posts views Thread by dustin lee | last post: by
2 posts views Thread by Michael Surette | last post: by
9 posts views Thread by Phil Jenson | last post: by
1 post views Thread by C Sharp beginner | last post: by
5 posts views Thread by half.italian | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.