Skip to content

Commit

Permalink
Fix cwd in include
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaylina committed Sep 7, 2022
1 parent 24df138 commit 8ce8033
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ module.exports = async function compile(Fr, fileName, ctx, config = {}) {
ctx.includedFiles[fullFileNameI] = true;
const oldNamespace = ctx.namespace;
ctx.namespace = "Global";
await compile(Fr, fullFileNameI, {...ctx, cwd: fileDir}, config);
const oldCwd = ctx.cwd;
ctx.cwd = fileDir;
await compile(Fr, fullFileNameI, ctx, config);
ctx.cwd = oldCwd;
ctx.namespace = oldNamespace;
if (pendingCommands.length>0) error(s, "command not allowed before include");
lastLineAllowsCommand = false;
Expand Down

0 comments on commit 8ce8033

Please sign in to comment.