more fixes for correct behavior with non-existent files

This commit is contained in:
Michel Oosterhof
2015-01-21 09:08:40 +00:00
parent 5286a8e85b
commit 4e0c6d9b34
2 changed files with 6 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ class command_cd(HoneyPotCommand):
try:
newpath = self.fs.resolve_path(path, self.honeypot.cwd)
newdir = self.fs.get_path(newpath)
except IndexError:
except:
newdir = None
if path == "-":
self.writeln('bash: cd: OLDPWD not set')

View File

@@ -97,7 +97,7 @@ class HoneyPotFilesystem(object):
ok = True
break
if not ok:
return None
raise FileNotFound
return cwd[A_CONTENTS]
def exists(self, path):
@@ -182,7 +182,10 @@ class HoneyPotFilesystem(object):
def is_dir(self, path):
if path == '/':
return True
dir = self.get_path(os.path.dirname(path))
try:
dir = self.get_path(os.path.dirname(path))
except:
dir = None
if dir is None:
return False
l = [x for x in dir