Commit 4c36ce04 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: do not save wrong path if user "cd" to a wrong directory

parent b0c0d799
......@@ -719,7 +719,7 @@ def runCommand():
cmd.append(os.environ.get('HOME'))
# shorten directory's name, to avoid things like : /a/../b
cd_dir = os.path.realpath(os.path.join(cwd, cmd[1]))
if os.path.exists(cd_dir):
if os.path.exists(cd_dir) and os.path.isdir(cd_dir):
cwd = cd_dir
# save new cwd in the config file
open(app.config['minishell_cwd_file'], 'w').write(cwd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment