From 84b2abc1237df52b89dad2d1ed1b7cb7b4ca1137 Mon Sep 17 00:00:00 2001 From: Justin Abrahms Date: Sun, 15 Mar 2020 13:57:35 -0700 Subject: [PATCH] Fix issue w/ mkdirp race condition Previously you would get this error due to imperfect path creation ``` node contrib/install-systemd-service.js fs.js:114 throw err; ^ Error: ENOENT: no such file or directory, copyfile '/home/justin/src/github.com/fraction/oasis/contrib/oasis.service' -> '/home/justin/.config/systemd/user/oasis.service' at Object.copyFileSync (fs.js:1728:3) at Object. (/home/justin/src/github.com/fraction/oasis/contrib/install-systemd-service.js:27:6) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) ``` --- contrib/install-systemd-service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/install-systemd-service.js b/contrib/install-systemd-service.js index 716c9f4..f28e4a0 100644 --- a/contrib/install-systemd-service.js +++ b/contrib/install-systemd-service.js @@ -21,7 +21,7 @@ const targetPath = path.join(systemdUserHome, "oasis.service"); if (fs.existsSync(targetPath)) { console.log("Cowardly refusing to overwrite file:", targetPath); } else { - mkdirp(systemdUserHome); + mkdirp.sync(systemdUserHome); const sourcePath = path.join(__dirname, "oasis.service"); fs.copyFileSync(sourcePath, targetPath);