[Tutor] handling timeouts, normal completion, or exceptions when interacting with CVS
Tony Cappellini
cappy2112 at gmail.com
Mon Nov 20 04:22:29 CET 2006
I've written a script which will checkout files from CVS, however, I don' t
know how to check for normal completion, errors or exceptions.
There are many people using CVS for this massive project, so we can't just
switch to a source control which has better scripting abilities.
We are stuck with cvs.
def SendCVSCommand(self)
self.__cvsCmd = "cvs update -A -C someArchiveName"
try:
hProcess = popen(self.__cvsCmd, "r") # will run the cvs command,
and checkout this module to the current directory
# HOW LONG DO WE WAIT BEFORE CONTINUING????
sleep(timeToWait)
# how do we check for errors??????????
hProcess.close()
except: # bad idea, but better than nothing for now
self.__FatalError = True
print"\nException was encountered while processing this cvs command
line %s\n" % commandLine
I'm using 30 seconds for the sleep time, but what I would like to do is exit
this routine early, if the CVS command finishes before 30 seconds are up.
I don't know how to check if the cvs command has finised normally, or with
errors.
Does anyone have any suggestions how to handle erros or completion in a
process like this?
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061119/153b05e3/attachment.html
More information about the Tutor
mailing list