Ok, I need to write code that calls the script, and if the operation in the script hangs, it ends the process.
Python is the preferred language, but I am also looking at the C documentation and the bash script.
Sounds like a light problem, but I can't decide on the best solution.
From research so far:
- Python: has some weird streaming model that uses a virtual machine one thread at a time won't work?
- C: The preferred solution seems to use SIGALARM + fork + execl. But SIGALARM is not safe on the heap, so can it destroy everything?
- Bash: timeout program? Not standard for all distributions?
Since I'm new to Linux, I probably don't know about 500 different gotchas with these features, so can someone tell me what is the safest and cleanest way?
Coder source share