1
0
Fork 0

Fix for detecting zero processes and better verbose output for that case.

main
Daniel Perelman 4 years ago
parent d35a6a124a
commit cb53b38a33

@ -338,14 +338,37 @@ do
exit
fi
limit_by_executable
num_watched_before="$(echo "$watched_pids" | wc -l)"
if [ -z "$watched_pids" ]
then
num_watched_before=0
else
num_watched_before="$(echo "$watched_pids" | wc -l)"
fi
limit_by_subprocess
num_watched_after="$(echo "$watched_pids" | wc -l)"
if [ -z "$watched_pids" ]
then
num_watched_after=0
else
num_watched_after="$(echo "$watched_pids" | wc -l)"
fi
if [ "$num_watched_before" -eq "$num_watched_after" ]
then
if [ "$watch_interval" = "0" ]
then
wait
if [ "$num_watched_after" -eq 0 ]
then
if [ -n "$verbose" ]
then
echo "No processes found, exiting. Specify --watch-interval to continue scanning for processes."
fi
exit
else
if [ -n "$verbose" ]
then
echo "Identified all processes to limit, waiting."
fi
wait
fi
else
sleep "$watch_interval"
fi

Loading…
Cancel
Save