Skip to content

Commit 4fccaea

Browse files
committed
fix(server): fix static server error when cwd not exists
1 parent 3a29c0d commit 4fccaea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/commands/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ exports.run = function (options) {
640640
dirLevel += i === 0 ? dirSections[i] : '/' + dirSections[i];
641641

642642
var searchDir = sysPath.join(cwd, dirLevel, '');
643-
if (fs.lstatSync(searchDir).isDirectory()) {
643+
if (fs.existsSync(searchDir) && fs.lstatSync(searchDir).isDirectory()) {
644644
var ykitConf = globby.sync(['ykit.*.js', 'ykit.js'], { cwd: searchDir })[0];
645645
if (ykitConf) {
646646
projectDir = searchDir;

src/commands/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ exports.run = (options) => {
629629
dirLevel += i === 0 ? dirSections[i] : '/' + dirSections[i] ;
630630

631631
const searchDir = sysPath.join(cwd, dirLevel, '');
632-
if (fs.lstatSync(searchDir).isDirectory()) {
632+
if (fs.existsSync(searchDir) && fs.lstatSync(searchDir).isDirectory()) {
633633
const ykitConf = globby.sync(['ykit.*.js', 'ykit.js'], {cwd: searchDir})[0];
634634
if(ykitConf) {
635635
projectDir = searchDir;

0 commit comments

Comments
 (0)