From dc40950eb10284f7dbe88fe8306e8aef6cee819e Mon Sep 17 00:00:00 2001 From: AlessandroZ Date: Tue, 31 Jan 2017 10:45:43 +0100 Subject: [PATCH] fix cd bug --- pupy/packages/all/pupyutils/basic_cmds.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pupy/packages/all/pupyutils/basic_cmds.py b/pupy/packages/all/pupyutils/basic_cmds.py index d15eccee..f4062e4c 100644 --- a/pupy/packages/all/pupyutils/basic_cmds.py +++ b/pupy/packages/all/pupyutils/basic_cmds.py @@ -79,8 +79,11 @@ def ls(path=None): def cd(path=None): if not path: home = os.path.expanduser("~") - os.chdir(home) - return + try: + os.chdir(home) + return + except: + return "[-] Home directory not found (or access denied): %s" % home path = os.path.join(os.getcwd(), path) if os.path.isdir(path):