By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,767 Members | 1,375 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,767 IT Pros & Developers. It's quick & easy.

threading/torking + killing a process

P: 1
I have to run a commandline tool and then parse its textoutput. Problem is the tool is pretty unreliable and often stops responding. It doesnt really crash just stops responding and doesnt exit.

First I used commands.getoutput() to run the tool and retrieve the output but as this will be deadlocked if the tool hangs again, this is no option now.

Now I need a way to either thread or fork the tool and a way to kill it after 30secs.

I came up with a unix way by using os.system(/bin/tool &) and then later kill it but this way is pretty ugly and doesnt give me the required output of the tool.

I saw many promissing methods in the os lib but don't see an easy way to fork + get the output (without using a pipe to a file and reading the file afterwards).

Any help is appreachiate.
Jul 12 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.