From d680ebeb98587a40db8970df7bab72d3e422ded5 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Thu, 17 Jun 2021 09:58:29 -0500 Subject: [PATCH] check parentDir exist --- dist/index.js | 5 ++++- ruby-builder.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 25d6f9d9b..835bc02cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -59465,6 +59465,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); const os = __webpack_require__(87) +const fs = __webpack_require__(747) const path = __webpack_require__(622) const exec = __webpack_require__(514) const io = __webpack_require__(436) @@ -59510,7 +59511,9 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { const parentDir = path.dirname(rubyPrefix) await io.rmRF(rubyPrefix) - await io.mkdirP(parentDir) + if (!fs.existsSync(parentDir)) { + await io.mkdirP(parentDir) + } const downloadPath = await common.measure('Downloading Ruby', async () => { const url = getDownloadURL(platform, engine, version) diff --git a/ruby-builder.js b/ruby-builder.js index 912a6b6c9..6f4e59889 100644 --- a/ruby-builder.js +++ b/ruby-builder.js @@ -1,4 +1,5 @@ const os = require('os') +const fs = require('fs') const path = require('path') const exec = require('@actions/exec') const io = require('@actions/io') @@ -44,7 +45,9 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) { const parentDir = path.dirname(rubyPrefix) await io.rmRF(rubyPrefix) - await io.mkdirP(parentDir) + if (!fs.existsSync(parentDir)) { + await io.mkdirP(parentDir) + } const downloadPath = await common.measure('Downloading Ruby', async () => { const url = getDownloadURL(platform, engine, version)