threads and timeout -> running a shell command / want to guard against infinite loops

Marcus Liddle m.liddle at
Tue Aug 19 23:11:08 CEST 2003

Tim Ottinger wrote:
> On Tue, 19 Aug 2003 14:21:14 +1200, Marcus Liddle wrote:
>><newbie hat>
>>I'm trying to get a really simple python program to
>>  run a bash testing script and kill itself if its
>>  been running to long (ie infinite loop)
>>create the thread object - test = TestThread()
>>run the command - test.do_command("infloop.bash")
>>if t.isAlive(): ...stop it
>>any good ideas?
> Have you considered pexpect? 

thank you for your advice.

I downloaded it (

and had play...

I think I require specific thread killing--the shell
  command I 'spawn' continues to run ...

I also had a look @ from

after a very quick look last night, I think a similar problem focus today will be on popen or another better way to
  control the execution.

Senior Assistant [mailto:m.liddle at]
Dept. of  Computer Science    University of Canterbury
Phone: +64 3  366-7001      ext: 7871      Office: 323
[ ]

More information about the Python-list mailing list