fix: throw cd hook only after changing directory

pull/69/head
sammyette 2021-06-14 18:11:07 -04:00
parent 30ffe9cab0
commit eab3f27ebf
No known key found for this signature in database
GPG Key ID: 50EE40A2809851F5
1 changed files with 2 additions and 1 deletions

View File

@ -10,7 +10,6 @@ if shlvl ~= nil then os.setenv('SHLVL', shlvl + 1) else os.setenv('SHLVL', 1) en
-- Builtins
commander.register('cd', function (args)
bait.throw('cd', args)
if #args > 0 then
local path = ''
for i = 1, #args do
@ -32,9 +31,11 @@ commander.register('cd', function (args)
end
return err
end
bait.throw('cd', path)
return
end
fs.cd(os.getenv 'HOME')
bait.throw('cd', os.getenv 'HOME')
return
end)