Skip to content

Commit

Permalink
fix: cd back to project root after build in case of another build
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jul 20, 2024
1 parent a7f1a43 commit 49124e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/luarocks/build/treesitter-parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function treesitter_parser.run(rockspec, no_install)
return nil,
"'tree-sitter CLI' is not installed.\n" .. rockspec.name .. " requires the tree-sitter CLI to build.\n"
end
local project_root = fs.absolute_name(dir.path("."))
if build.generate then
local js_runtime = os.getenv("TREE_SITTER_JS_RUNTIME") or "node"
local js_runtime_name = js_runtime == "node" and "Node JS" or js_runtime
Expand Down Expand Up @@ -172,6 +173,10 @@ function treesitter_parser.run(rockspec, no_install)
fs.make_dir(dest)
ok, err = fs.copy_contents(parser_dir, dest)
end
if build.location then
-- Change back to project root in case of another build
fs.change_dir(project_root)
end
return ok, err
end

Expand Down

0 comments on commit 49124e9

Please sign in to comment.