Problem:
I have a monitor program in Python that uses subprocess' Popen to start new processes. These processes have the potential to run for a very long time (weeks-months). I'm passing a file handle to stdout variable in Popen and I'm worried that this file will get huge easily. Is there a way I can safely move or remove the data in that log file?
Important Note: This is on a windows system so any solution has to be compatible with windows.
Code Snippet:
This is how I create the process.
try:
logFile = file(self.logFileName, 'w')
self.process = Popen(self.command, shell=False, stdout=logFile, stderr=STDOUT)
finally:
logFile.close()