inspect: Add function to read the first line of a file, with safety checks.