From 45991cb50203de74c1c1c5d26fc2da3fc6e9ea8e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 2 Jun 1998 18:46:57 +0000 Subject: Better error checking. svn path=/trunk/; revision=1872 --- fetchmailconf | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/fetchmailconf b/fetchmailconf index 6f1c74dc..828f4da4 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -1108,9 +1108,21 @@ if __name__ == '__main__': # Read the existing configuration tmpfile = "/tmp/fetchmailconf." + `os.getpid()` - os.system("fetchmail --configdump >" + tmpfile) - execfile(tmpfile) - os.remove(tmpfile) + try: + s = os.system("fechmail --configdump >" + tmpfile) + if s != 0: + print "Fetchmail run failure, status " + `s` + raise SystemExit + + s = execfile(tmpfile) + if s: + print "Invalid configuration, status " + `s` + raise SystemExit + except: + os.remove(tmpfile) + sys.exit(1) + else: + os.remove(tmpfile) # The tricky part -- initializing objects from the configuration global # `Configuration' is the top level of the object tree we're going to mung -- cgit v1.2.3