fix runWhileFile to work on RHEL