I have tested the alarm code in isolation using an infinite loop and it does work as expected. The alarm timeout works correctly when the external app is executed using "system" but as I need to collect the output I cannot use it.
Thank you for your reply.
Re^2: Backticks and SIGALRM
Replies are listed 'Best First'.