Solved the problem of trying to read from STDIN and stopping on the way when running from CRON or AWS Lambda.