Skip to content

Commit e1a44ee

Browse files
author
skywind3000
committed
fix: pushd leak in windows cmd
1 parent 9c0eb6c commit e1a44ee

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

z.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
-- z.lua - a cd command that learns, by skywind 2018, 2019, 2020
55
-- Licensed under MIT license.
66
--
7-
-- Version 1.8.10, Last Modified: 2020/12/23 16:37
7+
-- Version 1.8.11, Last Modified: 2020/12/31 01:44
88
--
99
-- * 10x faster than fasd and autojump, 3x faster than z.sh
1010
-- * available for posix shells: bash, zsh, sh, ash, dash, busybox
@@ -2548,12 +2548,18 @@ if /i "%RunMode%"=="-n" (
25482548
pushd !NewPath!
25492549
pushd !NewPath!
25502550
endlocal
2551-
popd
2551+
goto popdir
25522552
)
25532553
)
25542554
) else (
25552555
call "%LuaExe%" "%LuaScript%" "%RunMode%" %MatchType% %StrictSub% %InterMode% %StripMode% %*
25562556
)
2557+
goto end
2558+
:popdir
2559+
popd
2560+
setlocal
2561+
set "NewPath=%CD%"
2562+
endlocal & popd & cd /d "%NewPath%"
25572563
:end
25582564
]]
25592565

0 commit comments

Comments
 (0)