From b1f2a36639e6c915a3d6fc05566e249fca6aae66 Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Wed, 31 Mar 2021 13:46:49 -0400 Subject: [PATCH] fix: trim spaces in cd func --- golibs/fs/fs.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/golibs/fs/fs.go b/golibs/fs/fs.go index 98abef9..9e24f94 100644 --- a/golibs/fs/fs.go +++ b/golibs/fs/fs.go @@ -2,6 +2,7 @@ package fs import ( "os" + "strings" "github.com/yuin/gopher-lua" ) @@ -26,7 +27,7 @@ var exports = map[string]lua.LGFunction{ func cd(L *lua.LState) int { path := L.ToString(1) - err := os.Chdir(path) + err := os.Chdir(strings.TrimSpace(path)) if err != nil { switch err.(*os.PathError).Err.Error() { case "no such file or directory":