From ade385471058ec5f1d2626c01fffd393e2a82804 Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Fri, 18 May 2018 09:53:22 -0400 Subject: [PATCH] fix for process.chdir Fixes #1 --- lib/create-from-source.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/create-from-source.js b/lib/create-from-source.js index f2d465d..b7bb0ef 100644 --- a/lib/create-from-source.js +++ b/lib/create-from-source.js @@ -139,7 +139,17 @@ exports.compileToFSM = (src, opts={}) => new Promise((resolve, reject) => { // source, in case it does relative requires // or reads from that relative location const curdir = process.cwd() - process.chdir(ui.findFile(dir)) + + try { + process.chdir(ui.findFile(dir)) + } catch (err) { + if (dir.indexOf('@demos') >= 0) { + // this is probably ok, if the dir is one of our @demos + console.error(err) + } else { + throw err + } + } let res try {