From 0eb98cbb6c63e731ed37c6e2829feacc17418a27 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Thu, 23 Feb 2023 21:25:22 +0100 Subject: [PATCH] Use system temp dir for kube and helm cache dirs Resolves #63 --- main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 2a426e6..74dae6e 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,6 @@ async function main() { const homedir = require('os').homedir(); + const tempdir = require('os').tmpdir(); const fs = require('fs'); const {execFile} = require('child_process'); const tmp = require('tmp'); @@ -15,12 +16,12 @@ async function main() { postfix: '.sh', discardDescriptor: true, }); - const dockerKubeConfigDir = process.cwd() + '/docker-kube-config-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 13); + const dockerKubeConfigDir = tempdir + '/docker-kube-config-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 13); fs.mkdirSync(dockerKubeConfigDir, { mode: 0o777, }); const dockerKubeConfig = dockerKubeConfigDir + '/config'; - const helmCacheDir = process.cwd() + '/helm-cache-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 13); + const helmCacheDir = tempdir + '/helm-cache-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 13); fs.mkdirSync(helmCacheDir, { mode: 0o744, });