From 0ec36a8c0853efa5823b870042c7d805c09ea890 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Wed, 20 Oct 2021 15:53:21 +0200 Subject: [PATCH] fix(CLI): Handle gently case where temp folder is on other device --- lib/utils/logDeprecation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/logDeprecation.js b/lib/utils/logDeprecation.js index 143ccc0cb84..f9d84c492e1 100644 --- a/lib/utils/logDeprecation.js +++ b/lib/utils/logDeprecation.js @@ -8,6 +8,7 @@ const weakMemoizee = require('memoizee/weak'); const _ = require('lodash'); const resolveTmpdir = require('process-utils/tmpdir'); const ServerlessError = require('../serverless-error'); +const safeMoveFile = require('./fs/safeMoveFile'); const { style, legacy, log } = require('@serverless/utils/log'); const healthStatusFilename = require('./health-status-filename'); @@ -162,7 +163,7 @@ module.exports.printSummary = async () => { fse.ensureDir(path.dirname(healthStatusFilename)), fsp.writeFile(tmpHealthStatusFilename, healthStatus.join('\n')), ]); - await fsp.rename(tmpHealthStatusFilename, healthStatusFilename); + await safeMoveFile(tmpHealthStatusFilename, healthStatusFilename); if (bufferedDeprecations.length === 1) { const { code, message } = bufferedDeprecations[0];