Run command with CPU time (user time + system time) sense timeout.
- does not kill child process when child process is sleeping.
python demo.py sleepchild
u means LTL's Until operator.
utimeout use redis.
sudo apt-get install redis-server redis-doc
pip install redis
pip install git+https://github.com/cloverrose/utimeout.git
replace from subprocess import Popen
into from utimeout import Popen
.
- polling /proc/pid/stat files.
- inotify cannot use because /proc/pid/stat is pseudo file.
- use redis to store process ids.
- store process id when process start in utimeout.Popen.
- remove process id when /proc/pid/stat was deleted.
- because redis_key is generated by uuid.uuid4(), you can run utimeout.start concurrently.
cd sample
gcc fib.c -o fib
python demo.py sleepchild
python demo.py fibwrapper
python dmeo.py fibonacci