Optimize file read in CommandLine

If the input file is not stdin, then use freed instead of getline