Subprocess module fails to run command

前端 未结 3 536
说谎
说谎 2021-01-13 23:25

I\'m trying to execute Google\'s cpplint.py on a group of my files and collect the results to one log file. However, I have not managed to beat the subprocess module. My cur

3条回答
  •  伪装坚强ぢ
    2021-01-14 00:18

    I did it by replacing the def main() with the following (I editet the errorfunction too to get a proper csv-file):

    errorlog = sys.stderr
    sys.stderr = open("errorlog.csv","w")
    sys.stderr.write("File;Line;Message;Category;Confidence\n")
    for filename in filenames:
      ProcessFile(filename, _cpplint_state.verbose_level)
    _cpplint_state.PrintErrorCounts()
    sys.exit(_cpplint_state.error_count > 0)
    sys.stdout = errorlog
    sys.stderr.close()
    

提交回复
热议问题