pshved / timeout

A script to measure and limit CPU time and memory consumption of black-box processes in Linux
http://coldattic.info/shvedsky/pro/resourcelimit
485 stars 69 forks source link

pipe stdin? #12

Open wxdao opened 8 years ago

wxdao commented 8 years ago

I have a program that reads stdin to process something and i want to monitor its resource usage. However, cat /some/file | perl memlimit --detect-hangups -c -m 1000000 -t 10 meta/app or perl memlimit --detect-hangups -c -m 1000000 -t 10 meta/app < /some/file will just print FINISHED CPU 0.00 MEM 0 MAXMEM -1 STALE 0 MAXMEM_RSS -1

Apparently this script fails in such situation. What should I do?

pshved commented 8 years ago

Perhaps, modifying the script so that the parent closes STDIN after forking would help. I'm not sure, feel free to try and asend a patch if it worked.