From 32d1bdfee59f39a9a7fca84c9b9a84a3ed9a0876 Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 12 Mar 2020 18:09:06 +0800 Subject: [PATCH] fix: also check for "EISDIR" in `mkdirp` Fixes #10544. Though the `EISDIR` error code is not mentioned in the POSIX standard, FreeBSD and memfs both throws this error when trying to run `mkdir` on `/`. So essentially we should treat it the same as `EEXIST`. References: * https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=59739 * https://github.com/streamich/memfs/pull/326/ --- lib/util/fs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util/fs.js b/lib/util/fs.js index e122d566e7e..72831311134 100644 --- a/lib/util/fs.js +++ b/lib/util/fs.js @@ -141,7 +141,7 @@ const mkdirp = (fs, p, callback) => { }); }); return; - } else if (err.code === "EEXIST") { + } else if (err.code === "EEXIST" || err.code === "EISDIR") { callback(); return; }