summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base.py3
-rw-r--r--base/module.py2
-rwxr-xr-xports.py4
3 files changed, 8 insertions, 1 deletions
diff --git a/base/base.py b/base/base.py
index 836779b..1010af8 100644
--- a/base/base.py
+++ b/base/base.py
@@ -84,6 +84,7 @@ def shell():
# Go up a module in our stack
elif keyword in ('up', 'cd..', 'cd ..'):
+ shell.stack[-1].close()
shell.stack = shell.stack[:-1]
shell.prompt = shell.prompt[:-1]
@@ -96,6 +97,8 @@ def shell():
# Flush our module stack
elif keyword == 'cd':
+ for obj in shell.stack:
+ obj.close()
shell.stack = []
shell.prompt = prompt
diff --git a/base/module.py b/base/module.py
index d527ea0..58a4bc3 100644
--- a/base/module.py
+++ b/base/module.py
@@ -1,4 +1,6 @@
class Module(object):
""" Our parent class for all command modules """
+ def close(self):
+ raise NotImplementedError
pass
diff --git a/ports.py b/ports.py
index 7912243..95c0987 100755
--- a/ports.py
+++ b/ports.py
@@ -28,7 +28,9 @@ def main():
load_modules()
log.debug(args)
- print do_command(args)
+ output, module, params = do_command(args)
+ module.close()
+ log.info(output)
if __name__ == '__main__':
main() \ No newline at end of file