From 77729f3c610d84d3ead128c8e696fa40dc2b45d5 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Thu, 6 Dec 2012 16:16:43 +0800 Subject: [PATCH] Alias does not prevent init from being executed --- moodle-alias.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/moodle-alias.py b/moodle-alias.py index a9814f4..db7f0a4 100755 --- a/moodle-alias.py +++ b/moodle-alias.py @@ -27,7 +27,15 @@ import argparse from lib.tools import debug from lib.config import Conf -C = Conf() +try: + C = Conf() +except: + # Quietly die here. The main reason would be that the config file could not + # be loaded for some reason, which means that the environment has not been + # set yet. Therefore we exit quietly. This is a very specific case for + # moodle-alias as it is used in the Moodle bash script which does not know + # if the environment is properly set or not. + sys.exit() # Arguments parser = argparse.ArgumentParser(description='Manage your aliases') -- 2.11.0